I'm creating a multiple column list using the directions from this article:
http://csswizardry.com/2010/02/mutiple-column-lists-using-one-ul/
In a nutshell, it says to do something along the lines of this:
HTML:
<div class='block'>
<ul>
<li>
Item1
</li>
<li>
Item2
</li>
<li>
Item3
</li>
</ul>
</div>
CSS:
.block {
border: 1px solid black;
padding: 10px;
}
.block ul {
width: 100%;
overflow: hidden;
}
.block ul li {
display: inline;
float: left;
width: 50%;
}
And it works wonderfully, but I was mind-boggled at the overflow:hidden CSS declaration.
Without it, my outer div collapses like so:
http://jsfiddle.net/alininja/KQ9Nm/1/
When it's included, the outer div behaves exactly as how I would want it to be:
http://jsfiddle.net/alininja/KQ9Nm/2/
I'm wondering why overflow: hidden is triggering this behaviour. I would expect it to cutoff the inner li items instead of forcing the outer div to expand to the necessary height.
Thank you for looking!
overflow: hidden
tooverflow: auto
it still works. Wish I could explain why, but its a very interesting find. Thanks. – Lindioverflow:hidden
as it is a behavior offloat:left/right
. – Biddy