I have this code:
div#navigation a {
display: block;
padding: 7px 12px;
font-size: 18px;
}
div#navigation ul {
list-style: none;
margin: 0px auto;
}
div#navigation ul li {
float: left;
min-width: 50px;
text-align: center;
min-height: 30px;
}
div#navigation {
overflow: hidden;
}
<div id="navigation">
<ul>
<li>
<a href="/">Start</a>
</li>
<li>
<a href="">Test 1</a>
</li>
<li>
<a href="">Test 2</a>
</li>
<li>
<a href="">Test 3</a>
</li>
</ul>
</div>
What happens is that the <ul>
does not have any height, even though its list elements have some height. And clear
does not solve the problem.
I had the same problem with the <div id="navigation">
, but the last command solved the problem. Unfortunately this does not seem to work with <ul>
.
Could somebody explain me why this happens and how to avoid it?
`”_, but I don’t see that you have actually tried that.
– Sebastian Simon Aug 26 '16 at 20:26