How to center an image in a table cell

Hi,

A simple question really, but how do I vertically and horizontally center an image in a table cell using css.
I tried:

td {
text-align:center;
}

but that didn’t work.

A Google search turned up a few hits, but nothing useful that worked.

Thanks in advance.

Figured it out.
Another rule in the stupidly massive css file I inherited was applying ‘float:left’ to all images in the div I am working in.
Thanks Firebug!

one way to do it is

  1. put the image in a <div>

  2. give the <div> the width of the image

  3. set the <div>'s left and right margins to auto.

Figured it out.
Another rule in the stupidly massive css file I inherited was applying ‘float:left’ to all images in the div I am working in.
Thanks Firebug!

: ( I can only wish you good luck. Working with someone else’s code is almost always difficult, even if written well and documented.