Forum Moderators: not2easy
CSS code:
#gallery {
border:1px solid #888;
text-align: left;
background-color:#fff;
width: 530px;
padding: 10px;
}
#gallery ul.thumbs {
margin: 0 auto;
list-style: none;
}
#gallery .thumbs li {
float: left;
}
HTML code:
<div id="gallery">
<ul class="thumbs">
<li><img src="asd.jpg"></li>
</ul>
</div>
Here is my new code:
<div id="gallery">
<li><a class="thumbs" href="hayride/portrait12.jpg" rel="lightbox[photos]" title="Roll over and click right side of image to move forward. Roll over and click left side of image to move backward."><img src="hayride/portrait_thumb12.jpg"></a>
<li><a class="thumbs" href="hayride/portrait12.jpg" rel="lightbox[photos]" title="Roll over and click right side of image to move forward. Roll over and click left side of image to move backward."><img src="hayride/1thumb.JPG" height=100></a>
<li><a class="thumbs" href="hayride/portrait12.jpg" rel="lightbox[photos]" title="Roll over and click right side of image to move forward. Roll over and click left side of image to move backward."><img src="hayride/3thumb.JPG" height=100></a>
<li><a class="thumbs" href="hayride/portrait12.jpg" rel="lightbox[photos]" title="Roll over and click right side of image to move forward. Roll over and click left side of image to move backward."><img src="hayride/5thumb.JPG" height=100></a>
<li><a class="thumbs" href="hayride/portrait12.JPG" rel="lightbox[photos]" title="Roll over and click right side of image to move forward. Roll over and click left side of image to move backward."><img src="hayride/7thumb.JPG" height=100></a>
<div style="clear: both;"></div>
<li><a class="thumbs" href="hayride/portrait12.jpg" rel="lightbox[photos]" title="Roll over and click right side of image to move forward. Roll over and click left side of image to move backward."><img src="hayride/DSC_0201thumb.jpg" height=100></a>
<li><a class="thumbs" href="hayride/portrait12.jpg" rel="lightbox[photos]" title="Roll over and click right side of image to move forward. Roll over and click left side of image to move backward."><img src="hayride/DSC_0212thumb.jpg" height=100></a>
<li><a class="thumbs" href="hayride/portrait12.jpg" rel="lightbox[photos]" title="Roll over and click right side of image to move forward. Roll over and click left side of image to move backward."><img src="hayride/DSC_0295thumb.jpg" height=100></a>
</p>
<div style="clear: both;"></div>
</li>
</ul>
</div>
And maybe consider an HTML4.0 DOCTYPE rather than XHTML (seeing as though you aren't extending HTML)
1. You can "contain" floated elements by floating the parent element. A floated parent will always "shrink wrap" or contain it's children.
<div style="width: 100%; float: left;">
<div style="float: left; width: 28%;">Some div</div>
<div style="float: left; width: 28%;">Some div</div>
<div style="float: left; width: 28%;">Some div</div>
</div>
2. You can "contain" floated elements by adjusting the overflow property, but this may create some odd issues if the content actually has to overflow:
<div style="overflow:hidden">
3. As you've done, you can force a div to contain it's children by placing a clearing div below the last element:
<div style="clear:both"></div>
Here is the problem with #3. Not only does it add extra code to your document, it may clear to elements you wouldn't expect. For example, if you have a three column layout and the thumbnails are in the center column, your first clear will clear all the way to the bottom of the left column, leaving nothing but white space above. UCK!
For your solution, I would use #1, it will make it more portable to various conditions than #2 or #3. Float the parent left, then float your UL's left as well, removing margins and padding as needed.
And I agree with the doctype, as long as it is a valid doctype there is no reason to use XHTML unless you require features only present in XHTML. It will make life a lot easier.