As I work on my product landing page, I encountered an interesting issue when trying to change the color of the navigation bar. It seems that I can only do so after adding the overflow property to the ul element. Can someone shed some light on why this is necessary? I understand that overflow:hidden prevents text from going outside the list, but I'm curious about its connection to changing colors.
ul{
list-style-type: none;
margin: 0;
padding: 0;
background-color: #dddddd;
overflow: hidden;
}
li{
float: left;
}
li a{
display: block;
padding: 30px;
}
If you're interested, here's the link to the project https://codepen.io/Alicinetto/pen/PowOvxM