Can't get a border around a html div element

你说的曾经没有我的故事 提交于 2020-01-02 00:58:06

问题


I can't figure out why I can't get a border around my div here. My jsfiddle is:

http://jsfiddle.net/4HnKs/1/

I must just be crazy from staring at my computer screen but if you look at the class verticalmembersmenu in the CSS, I can't for the life of me figure out why I can't get the border around the div.


回答1:


You are using HTML style comments in your CSS, that seems to be breaking the rendering, take a look at http://jsfiddle.net/4HnKs/3/

Some info on comments over at http://www.w3.org/TR/CSS2/syndata.html#comments




回答2:


u can give inline style to div as

 <div class="verticalmembersmenu" style = "border:1px solid black;">

or

.verticalmembersmenu ul{
list-style:none; border:1px solid black;
}



回答3:


please give the border in ul tag.

.verticalmembersmenu ul{
    list-style:none; border:1px solid black;
    }



回答4:


It took me a while to find, but the problem actually has to do with your css formatting. The css doesn't recognize html comment tags, but instead uses /* */.

 <!--MEMBERS LAYOUT START -->
.verticalmembersmenu {
    height:300px;
    width:300px;
    border:1px solid black;
}

.verticalmembersmenu ul{
    list-style:none;
}


<!--MEMBERS LAYOUT END -->


来源:https://stackoverflow.com/questions/8798677/cant-get-a-border-around-a-html-div-element

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!