I am currently learning CSS and currently I get stuck on "overflow". Here are the codes that I am practicing. I do not understand why when I turn it to overflow: visible, then the webpage will turn to be white? Why is it the case? I have tried all other possible solutions on overflow, like auto, scroll. They all works the way I expect, but not the case of visible? Can anyone explain to me why is it the case?
In my css,
* {
color: white;
margin: 0;
padding: 0;
}
#horizontal_bar {
background-color: black;
overflow: hidden; /* When I change it to overflow: visible; the webpage turns white, why is it the case? */
margin-top: 2em;
}
#horizontal_bar ul li{
list-style-type: none;
float: left;
padding-top: 5px;
padding-bottom: 5px;
}
#horizontal_bar ul li img {
height: 12px;
}
#horizontal_bar ul li a {
text-decoration: none;
padding: 5px 20px;
height: 12px;
}
a:focus, a:hover {
background-color: gray;
}
#content {
clear: left;
}
In my HTML,
<body>
<div id="horizontal_bar">
<ul>
<li><a href="" >HTML</a></li>
<li><a href="" >CSS</a></li>
<li><a href="" >JAVASCRIPT</a></li>
<li><a href="" >SQL</a></li>
<li><a href="" >PHP</a></li>
<li><a href="" >jQuery</a></li>
<li><a href="" ><img src="images/search2.png" alt="search"/></a></li>
</ul>
</div>
<div id="content">
<p>Hello</p>
</div>
</body>
Here are the 2 screenshots I have captured. The first one is the case, when I set overflow attribute as hidden, and the later one is the case when I set overflow attribute as visible.
Hope to have a nice explanation on why it is the case when overflow = visible. Thanks.