CSS:
ul#navlist {
list-style-type: none;
padding: 0;
margin: 0;
float: left;
width: 100%;
color: #fff;
background-color: #036;
}
ul#navlist li {
display: inline;
}
ul#navlist li a {
float: left;
width: 5em;
color: #fff;
background-color: #036;
padding: .2em 1em;
text-decoration: none;
border-right: 1px solid #fff;
}
ul#navlist li a:hover {
background-color: #369;
color: #fff;
}
HTML:
<ul id="navlist">
<li><a href="#">Item one</a></li>
<li><a href="#">Item two</a></li>
<li><a href="#">Item three</a></li>
</ul>
问题:
如果我删除此行:float:left
inside ul#navlist
,background-color: #036;
将不会显示,为什么?