Forum Moderators: open
What is the best way to insert a photo with a caption (sometimes 2 or 3 photos per page)?
My only criteria is that it should be easy to do on all pages and should look good in Netscape 6, IE6 and Firefox.
Thanks.
Place both within a <div> i.e.
HTML:
<div class="image-div">
<img src="an-image.png" alt="" />
<p>An Image</p>
</div>
CSS:
* {padding: 0; margin: 0;
}
.image-div {width: 10em; height: 11em; background: #ffd;
}
.image-div img {width: 10em; height: 10em; vertical-align: bottom;
}
.image-div p {background: #ddf; text-align: center;
}
Use a <dl> [definition list] i.e.
<dl>
<dt><img src="an-image.png" alt="" /></dt>
<dd>An Image</dd>
</dl>
CSS:
* {padding: 0; margin: 0;
}
dl {width: 10em; height: 11em; background: #ffd;
}
dt img {width: 10em; height: 10em; vertical-align: bottom;
}
dd {background: #ddf; text-align: center;
}
Note that you can use px in place of em if preferred.
Note that padding/margin can be adjusted as wanted.
Which method is easiest is personnel preference and requirements.
[webmasterworld.com...]
In particular msg #6 by SuzyUK. Could be just what you're looking for. :)