Here is the code
ul {
list-style-type: none;
margin: 0;
padding: 0;
overflow: hidden; /*The problem is here*/
background-color: #333;
}
li {
float: left;
}
li a {
display: inline-block;
color: blue;
text-align: center;
padding: 14px 16px;
text-decoration: none;
}
li a:hover {
background-color: #111;
}
.active {
background-color: red;
}
<ul>
<li><a href="#home" class="active">Home</a></li>
<li><a href="#news">News</a></li>
<li><a href="#contact">Contact</a></li>
<li><a href="#about">About</a></li>
</ul>
In the ul style the overflow hidden is being used. Now when overflow hidden is used the background color of the navigation bar turns to black like
But when I delete the overflow:hidden the background color disappears like
Now basically im just confused because overflow: hidden just hides the overflowing stuff in a container so why here its making a background color appear?