Forum Moderators: not2easy
In the left float I have an image with captions beneath it. The site is dynamic and the image size can vary. I want the captions to be centered underneath the image.
The following works in IE5, IE6, Opera, and Safari, but not in Netscape 7.
<div class="prodbox" id="prodbox">
<div class="photo" id="photo"><img src="image.gif" /><br />Caption
<div class="buynow" id="buynow">Button</div>
</div>
<h3>content</h3>
<span class="specifics" id="specifics">content</span>
</div>
.prodbox {
float: right;
}
.photo {
float: left;
margin: 3px 4px 4px 0px;
padding: 5px 4px;
text-align: center;
}
I looked everywhere for a solution, but haven't found anything.
The only thing is, I removed the id attributes.
Whilst you can give an element both an id and a class, generally you only need to give it one or the other.
If the item is unique - ie. it only appears on the page once - then it should have an id. Otherwise, as in the case of your 'prodbox', if the item occurs several times on the same page then you only need to give it a class.
The site is dynamic and the image size can vary. I want the captions to be centered underneath the image.
You can only use CSS for captions if you are sure that the text is shorter than the image width.
The technique I use is a 1-pixel-wide table:
table.imgr {margin: 5px 0px 5px 15px; font-size:x-small; text-align:center; float:right; }<table class="imgr" width="1"><tr><td>
<img src="picture.gif" width="50" height="50" alt="">
</td></tr><tr><td>This is my wonderful picture that I made all by my little self
</td></tr></table>
Try one of the soultions on this page and let me know if they work.
[pennlinepublishing.com...]
Good Luck!
Dan