TheInsider
Programmer
Hi,
Hopefully someone can help me with this. I'm trying to create a reusable div "pane" that can be modified to stack vertically or horizontally.
The concept is like the search rows returned on Ebay, where each box will represent an individual item result. However, I want the layout to be more dynamic. For example, on one page, I will set the width to 100%, so the divs stack vertically. On another page, I want the divs to align left so they run horizontally. (The text inside the div will adjust according.)
In summary, the results page could look like:
#
#
#
#
or:
####
####
where # is a single div pane.
So far I've managed to hack something together that works in IE7, Safari, and Firefox 3. However, the line-height and vertical-align in the a.thumbnail class only centers the image vertically in Safari and Firefox. I can't get images that are shorter than 134px to center vertically in IE7. If you try the code below with 50px x 50px image, you'll see it works properly in Firefox but not IE.
That said, the line-height does create odd results in Firefox if I don't set the overflow: hidden for a.thumbnail.
I appreciate any help.
TIA!
Hopefully someone can help me with this. I'm trying to create a reusable div "pane" that can be modified to stack vertically or horizontally.
The concept is like the search rows returned on Ebay, where each box will represent an individual item result. However, I want the layout to be more dynamic. For example, on one page, I will set the width to 100%, so the divs stack vertically. On another page, I want the divs to align left so they run horizontally. (The text inside the div will adjust according.)
In summary, the results page could look like:
#
#
#
#
or:
####
####
where # is a single div pane.
So far I've managed to hack something together that works in IE7, Safari, and Firefox 3. However, the line-height and vertical-align in the a.thumbnail class only centers the image vertically in Safari and Firefox. I can't get images that are shorter than 134px to center vertically in IE7. If you try the code below with 50px x 50px image, you'll see it works properly in Firefox but not IE.
That said, the line-height does create odd results in Firefox if I don't set the overflow: hidden for a.thumbnail.
I appreciate any help.
TIA!
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
<html>
<head>
</head>
<body>
<style type="text/css">
a:active, a:link, a:visited {
text-decoration: none;
color: #0066cc;
}
div#main {
width: 700px;
}
img {
border: none;
}
div.previewPane {
display: inline;
float: left; /* required for [display: inline] effect to display correctly in Mozilla */
margin: 0 9px 9px 0;
width: 169px;
height: 200px;
overflow: auto;
border: 1px solid #ceceda;
}
div.previewPane a.thumbnail {
float: left;
width: 134px;
height: 134px;
margin: 0 9px 9px 0;
border: 1px solid #ceceda;
text-align: center;
/* the code below only works in Safari and Firefox but not IE7 */
line-height: 134px;
vertical-align: middle;
}
div.previewPane a.thumbnail img {
max-width: 134px;
max-height: 134px;
}
div.previewPane p {
margin: 0;
padding: 9px;
}
</style>
<div id="main">
<div class="previewPane">
<p><a class="thumbnail" href="default.php"><img src="images/no_preview.gif"></a>words words words words words words words words words words words words words words words words words</p>
</div>
<div class="previewPane">
<p><a class="thumbnail" href="default.php"><img src="images/no_preview.gif"></a>words words words</p>
</div>
<div class="previewPane">
<p><a class="thumbnail" href="default.php"><img src="images/no_preview.gif"></a>words words words</p>
</div>
<div class="previewPane">
<p><a class="thumbnail" href="default.php"><img src="images/no_preview.gif"></a>words words words</p>
</div>
<div class="previewPane">
<p><a class="thumbnail" href="default.php"><img src="images/no_preview.gif"></a>words words words</p>
</div>
<div class="previewPane" style="width: 300px;">
<p><a class="thumbnail" href="default.php"><img src="images/no_preview.gif" width="50" width="50"></a>words words words</p>
</div>
</div>
</body>
</html>