Can't get a border around a html div element

2019-04-19 11:56发布

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.

标签: css html border
4条回答
贪生不怕死
2楼-- · 2019-04-19 12:44

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

查看更多
做自己的国王
3楼-- · 2019-04-19 12:49

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;
}
查看更多
Bombasti
4楼-- · 2019-04-19 12:50

please give the border in ul tag.

.verticalmembersmenu ul{
    list-style:none; border:1px solid black;
    }
查看更多
趁早两清
5楼-- · 2019-04-19 12:51

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 -->
查看更多
登录 后发表回答