Forum Moderators: not2easy

Message Too Old, No Replies

CSS image table layout

Looks great in IE6 & 7 but not Firefox

         

the_todd

7:37 pm on Apr 26, 2007 (gmt 0)

10+ Year Member



This is the opposite of my usual problem. In the sample html below the #wrapper looks great in IE but doesn't wrap all the div's in firefox. I'd appreciate any help.


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>
<title>Hello!</title>

<style type="text/css">
<!--
#thumb_table_wrapper {
border:1px solid black;
height:auto;
padding:5px;
width:60%;
text-align:center;
}
#image {
border:1px dashed Gray;
float:left;
margin:4px;
padding-top:6px;
position:relative;
height:150px;
width:150px;
}

-->
</style>

</head>

<body>

<div id="thumb_table_wrapper">

<div id="image">
<img src="../user_files/1/thumb_1.jpg" />
<br />
Image
</div>
<div id="image">
<img src="../user_files/1/thumb_2.jpg" />
<br />
Image
</div>
<div id="image">
<img src="../user_files/1/thumb_3.jpg" />
<br />
Image
</div>
<div id="image">
<img src="../user_files/1/thumb_4.jpg" />
<br />
Image
</div>
<div id="image">
<img src="../user_files/1/thumb_1.jpg" />
<br />
Image
</div>
<div id="image">
<img src="../user_files/1/thumb_2.jpg" />
<br />
Image
</div>
<div id="image">
<img src="../user_files/1/thumb_3.jpg" />
<br />
Image
</div>
<div id="image">
<img src="../user_files/1/thumb_4.jpg" />
<br />
Image
</div>

</div>

</body>

</html>

Regards,
Todd

Dabrowski

10:55 pm on Apr 26, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Todd, this is a hack I learnt a while ago:

#thumb_table_wrapper { 
overflow: auto;
}

Setting overflow to auto shouldn't cause scrolling as your #images's are a fixed width, hence will wrap.

But the overflow auto causes floated children to be contained, whereas normally they would break out.

Also, you can only have one ID per page, change your id='image' to class='image'.