Live Example: (Read the CSS Newbie article)

Source Code: (Save the Source)

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>CSS Newbie Example: Simple, Stylish and Swappable Image Captions</title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<script>
$(document).ready(function() {
   $("img.hascaption").each(function() {
      $(this).wrap('<div class="figure"></div>')
      .after('<p class="caption">'+$(this).attr("title")+'</p>')
      .removeAttr('title');
   });
   $(".figure").width($(this).find('img').width());
      
   $(".figure").mouseenter(function(){
      $(this).find('.caption').slideToggle();
   }).mouseleave(function(){
      $(this).find('.caption').slideToggle();
   });
});
</script>
<style>
   body {
      font: small/1.4 Arial, Helvetica, sans-serif; }
   #wrap {
      width: 500px;
      margin: 0 auto; }
   .figure {
      position: relative; }
   .figure p.caption {
      display: none;
      position: absolute;
      bottom: 0px;
      left: 0px;
      width: 94%;
      margin: 0;
      padding: 5px 3%;
      background-color: #555;
      color: #fff;
      font-weight: bold; }
</style>
</head>
<body>
<div id="wrap">
   <h1>Simple, Stylish and Swappable Image Captions</h1>
   <p>The example below uses a simple image tag and title attribute to create an easy, semantic image captioning system with the help of jQuery (and some CSS to make things prettier).</p>
   <p>Mouse over the image below to view its corresponding caption!</p>
   <p><a href="http://www.cssnewbie.com/how-to-create-simple-stylish-and-swappable-image-captions/">You can view the original article here.</a></p>

   <img src="http://farm4.static.flickr.com/3314/3314211481_4e00a1f471.jpg" width="500" height="250" class="hascaption" title="Mentions of 'Martha Stewart' (red) versus 'Darfur' (blue) from 2004 - 2009 in the New York Times. Visualization by Jer Thorp (blprnt_van)." />
   
   <p><strong>Update:</strong> This code has been modified slightly from the original to work in IE7.</p>
   
</div>

</body>
</html>