DIV's overspilling my Container DIV in Firefox (Full Version)

All Forums >> [Web Development] >> Cascading Style Sheets



Message


craigj1303 -> DIV's overspilling my Container DIV in Firefox (5/16/2007 10:25:11)

Hi all

I am presenting thumbnails within a container DIV. The container has no height attribute in the CSS file. I am working on 3 different pages of thumbnails all with different numbers of thumbnails within.

In IE the height of the container DIV increases and decreases depending on how many thumbnails are within it. However, in Firefox the thumbnails "overspill" outside of the container DIV unless I specify a height attribute in the CSS to make it high enough. Obviously I don't want to do this because every page needs to be a different height.

Is there anything I can put in the CSS to make Firefox adjust the height of the container DIV depend on how many thumbs there are like IE does?

This is the CSS I have:

#gallerycontainer {
 width: 700px;
 margin: 0 auto;
 background: #EFE6C5;
 text-align: center;
 border: solid black 1px;
 }
 
.galleryimg {
 border: solid 1px #330000;
 border-width: 3px;
 }
 
div.mainleft{
 float: left;
 width: 232px;
 height: 180px;
 margin-top: 30px;
 }


Also, here is a link to the gallerys. Essex, Wales, West Country and Misc all have different number of images.

http://uk.geocities.com/johnson463@b...m/gallery.html




Donkey -> RE: DIV's overspilling my Container DIV in Firefox (5/16/2007 11:01:00)

Your link doesn't work so I can't test this, but I suspect a spacer div may be the answer. Try putting this in the CSS
/*
Spacer Div
*/
div.spacer{
clear: both !important;
}


And insert this inside the containing div but below the last thumbnail.
<div class="spacer">&nbsp;</div><!--/clears and spaces-->




Tailslide -> RE: DIV's overspilling my Container DIV in Firefox (5/16/2007 11:24:17)

Because you're floating the thumbs they basically take up no space (well actually it's sort of like a single line's worth of space) so Firefox and other non-IE browsers can't expand the containing div to contain them.

If your clearing element isn't working then try adding "overflow:hidden" to the div which contains the floated thumbs - that usually does the trick.




craigj1303 -> RE: DIV's overspilling my Container DIV in Firefox (5/16/2007 13:10:35)

Thanks a lot guys, the spacer DIV worked great. Firefox now renders the page perfectly!




Page: [1]

Valid CSS!




Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI
0.046875