Using CSS instead of tables to create a centered column of images

Posted by pcampbell on Stack Overflow See other posts from Stack Overflow or by pcampbell
Published on 2010-04-07T21:34:21Z Indexed on 2010/04/07 21:43 UTC
Read the original article Hit count: 147

Filed under:
|

Consider the task of replacing this table with CSS stylings:

<table border="1">
  <tr><td align="center">
       <img src="foo" />
  </td></tr>
  <tr><td align="center">
       <img src="bar" />
    </td></tr>
  <tr><td align="center">
       <img src="bat" />
    </td></tr>
</table>

The desired output is 3 images stacked on top of each other. The images are centered on the widest of them all.

How would you style this markup with <div> around those <img> tags with CSS to achieve the same look?

© Stack Overflow or respective owner

Related posts about css

Related posts about html