I have a fluid grid built with <li> elements.
eg:
<ul>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
</ul>
li
{
border:solid 1px green;
width: 100px;
min-height:50px;
display: inline;
margin: 10px;
float: left;
}
so this looks something like:
----------- ----------- -----------
| | | | | |
| | | | | |
----------- ----------- -----------
----------- ----------- -----------
| | | | | |
| | | | | |
----------- ----------- -----------
hooray!
The problem is when I add content in one of the <li> elements which stretches the height. I want to end up with something like this:
----------- ----------- -----------
| apples | | | | |
| oranges | | | | |
| lemons | ----------- -----------
| cherries|
-----------
----------- ----------- -----------
| | | | | |
| | | | | |
----------- ----------- -----------
But I actually end up with something like this:
----------- ----------- -----------
| apples | | | | |
| oranges | | | | |
| lemons | ----------- -----------
| cherries|
----------- ----------- -----------
| | | |
| | | |
----------- -----------
-----------
| |
| |
-----------
booo!
So basically, I’m trying to keep the ‘row’ aligned when one of the <li>s is pushed down from the above element, instead of it pushing to the available space to the right.
Have a look at the code below.
Obviously the IE hacks and moz rules should be moved into conditional stylesheets and there are some padding issues (read: use a css reset)
but other than that this should do the trick….
alt text http://img835.imageshack.us/img835/9594/example1281542227415.png
Example