CSS tip to add a caption or title to an image on your website. Easy to follow example. Test it out and play with the settings to create your own look.

Adding a Caption to an Image with CSS

By Linda Chadbourne | March 17th, 2008 |
Category: Tips & Tricks | Tags: |

Want an easy way to add a caption to an image like this?

HTML



<div class="imagecaption">
<img src="your-image-here.jpg">
<alt="Stacked" width="150" height"100" /><p>Orange Pyramid</p> </div>

CSS


.imagecaption {
      width: 200px;
      border: 1px solid #999999;
      padding: .5em;
      }
p {
      font: small Verdana, Arial, Helvetica, sans-serif;
      text-align: center;
      }
Then go ahead ... say it.

Leave a Reply

Comment Preview: