Forum Moderators: not2easy
If for example I have 6 images, and want them to display in 2 rows of 3, but want the flexibility for it to condense into 3 rows of 2, or even 6 rows of 1.
If I just float them all to the left, then if the resolution is high, then I get one row of 4, and one row of 2. Ugly.
It probably could be done with some clearing, but I'm stuck.
Thanks for any advice
<ul id="gallery">
<li><img src="image1.jpg" width="100" height="100" alt="" /></li>
<li><img src="image2.jpg" width="100" height="100" alt="" /></li>
<li><img src="image3.jpg" width="100" height="100" alt="" /></li>
<li><img src="image4.jpg" width="100" height="100" alt="" /></li>
</ul> all you've got to do is float the <li>'s to the left, like you've been doing with your images already, but put a maximum width on the <ul>. that way it won't grow beyond a certain width.
Damn, I've just done it (I have been working on it for a while)
Just add clear:left to all the images in the left hand column and it works.
Sorry for that, but thanks for the quick reply!
UPDATE: However, now if the resolution gets too big, IE wants to stick the images in the bottom row up at the top.
FIXED: I've added a <br /> after each row, IE won't then stick up an image from a lower row on to the end of a higher one.
<ul id="gallery">
<li><img src="image1.jpg" width="100" height="100" alt="" /> Caption for image1</li>
<li><img src="image2.jpg" width="100" height="100" alt="" /> Caption for image2</li>
<li><img src="image3.jpg" width="100" height="100" alt="" /> Caption for image3</li>
<li><img src="image4.jpg" width="100" height="100" alt="" /> Caption for image4</li>
</ul> and the CSS...
#gallery { list-style-type:none; max-width:600px; }
#gallery li { float:left; margin:0 10px 0 0; font-size:75%; text-align:center; }
#gallery img { display:block; }