keith
02-06-2009, 07:36 AM
Hi all,
I am keith and today I want to let you know all of you "How To Add a Caption to Your Images that Stays with the Image".Please have a look:-
Captions provide extra information about your Web images, but they can be difficult to add to Web pages without some extra HTML and CSS. This explains how to add a simple, yet nice looking caption to your images that will stick with your image where ever you place it on the page.
Add your image to your Web page.
Place a div tag around the image:
<div><img src="URL" alt="alternate text" width="width" height="height" /></div>
Add a style attribute to the div tag:
<div style=""><img src="URL" alt="alternate text" width="width" height="height" /></div>
Set the width of the div to the same width as the image, with the width style property:
<div style="width:image width px;"><img src="URL" alt="alternate text" width="width" height="height" /></div>
I like my captions to be slightly smaller than the surrounding text, so add a font-size property to your div style:
<div style="width:image width px; font-size:80%;"><img src="URL" alt="alternate text" width="width" height="height" /></div>
# Captions look best if they are centered below the image, so add a text-align property to your style attribute:
<div style="width:image width px; font-size:80%; text-align:center;"><img src="URL" alt="alternate text" width="width" height="height" /></div>
# Finally, you'll want a little more space between the image and the caption, so you'll need to add a style attribute to your image with a padding-bottom style property on it:
<div style="width:image width px; font-size:80%; text-align:center;"><img src="URL" alt="alternate text" width="width" height="height" style="padding-bottom:0.5em;" /></div>
# Then add your text caption directly below the image:
<div style="width:image width px; font-size:80%; text-align:center;"><img src="URL" alt="alternate text" width="width" height="height" style="padding-bottom:0.5em;" />This is my caption</div>
# Upload your Web page to your server and test it in a browser.
I am keith and today I want to let you know all of you "How To Add a Caption to Your Images that Stays with the Image".Please have a look:-
Captions provide extra information about your Web images, but they can be difficult to add to Web pages without some extra HTML and CSS. This explains how to add a simple, yet nice looking caption to your images that will stick with your image where ever you place it on the page.
Add your image to your Web page.
Place a div tag around the image:
<div><img src="URL" alt="alternate text" width="width" height="height" /></div>
Add a style attribute to the div tag:
<div style=""><img src="URL" alt="alternate text" width="width" height="height" /></div>
Set the width of the div to the same width as the image, with the width style property:
<div style="width:image width px;"><img src="URL" alt="alternate text" width="width" height="height" /></div>
I like my captions to be slightly smaller than the surrounding text, so add a font-size property to your div style:
<div style="width:image width px; font-size:80%;"><img src="URL" alt="alternate text" width="width" height="height" /></div>
# Captions look best if they are centered below the image, so add a text-align property to your style attribute:
<div style="width:image width px; font-size:80%; text-align:center;"><img src="URL" alt="alternate text" width="width" height="height" /></div>
# Finally, you'll want a little more space between the image and the caption, so you'll need to add a style attribute to your image with a padding-bottom style property on it:
<div style="width:image width px; font-size:80%; text-align:center;"><img src="URL" alt="alternate text" width="width" height="height" style="padding-bottom:0.5em;" /></div>
# Then add your text caption directly below the image:
<div style="width:image width px; font-size:80%; text-align:center;"><img src="URL" alt="alternate text" width="width" height="height" style="padding-bottom:0.5em;" />This is my caption</div>
# Upload your Web page to your server and test it in a browser.