I'm creating a menu and I want to put a background color on it, however, when I try to apply a backgrond-color: #333
to an element ul
NOT overflow: hidden;
, the color does not appear.
Why does this happen if overflow
has nothing to do with background color? What does overflow
really serve?
CSS CODE:
ul {
list-style-type: none;
margin: 0;
padding: 0;
overflow: hidden;
background-color: #333;
}
li {
float: left;
}
li a {
display: block;
padding: 8px;
}
HTML CODE:
<ul>
<li><a href="#">Home</a></li>
<li><a href="#">Noticias</a></li>
<li><a href="#">Contato</a></li>
<li><a href="#">Sobre</a></li>
</ul>