In the following code, why does the ul
element loose its background color when the child elements are floated?
I remember reading something about floats causing this, but I cannot remember.
(JSFiddle)
ul {
padding-left: 0;
background-color: #036;
}
ul li {
float: left;
}
<div id="nav">
<ul>
<li class="active"><a href="#">Home</a></li>
<li><a href="#">Services</a></li>
<li><a href="#">About Us</a></li>
<li><a href="#">Contact Us</a></li>
</ul>
</div>