Bob
Bob

Reputation: 8504

Center image above text

I want to display several images next to each other and each image has a date below it. The date is wider than the image and I would like to center the image on top of the date. Here's a code snippet

<div style="float:left">
      <div class="newsfeed_photo">
      <a href="...">
      <img alt="Small" class="photo_thumb_frame" src="..." />
      </a></div>
      <div class="newsfeed_date">
      (08/17/11 03:29pm)
      </div>
</div>
<div style="float:left">
      <div class="newsfeed_photo">
      <a href="...">
      <img alt="Small" class="photo_thumb_frame" src="..." />
      </a></div>
      <div class="newsfeed_date">
      (08/22/11 02:16pm)
      </div>
</div>

Upvotes: 2

Views: 11091

Answers (1)

James Montagne
James Montagne

Reputation: 78690

If I'm understanding you right, you should just be able to use text-align: center:

http://jsfiddle.net/rahjU/

Upvotes: 4

Related Questions