Text Caption for Images
I've been using CSS for about a year now but I have a problem I can't seem to fix and was hoping someone on this forum might have a possible solution.
I have a div tag which holds an image and within that div there is another which holds a comment which sits under the image.
Both Divs are classes that I want to use throughout a website.
The problem I have is that I want the div to re-size to fit any image that goes in but I need the comment text to be 80% of the width of the picture, no matter what size it is.
How do I acheive this when the width of the images can be different from one page to the next?
The only reliable way cross-browser is to use a table for this.
You can do it for most browser except IE by using some advanced techniques.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
border:1px solid #000;
<td><img src="images/small.jpg" alt="" width="100" height="90" />
<p>Testing this caption to see what happens</p></td>
However IE won't wrap the captions.
That is such a simple and effective idea!!!!
I've been totally blinkered about never using tables again (except for tabulated data of course, "the art & science of CSS", page 181).
I'm very grateful for the tip Paul.