Previous Message
Next Message

How to vertically center img in div?

Sent by Philippe Wittenbergh on 22 September 2004 06:06

On Sep 22, 2004, at 8:40 am, Steve Clay wrote:

> * fairly cross-browser
> * container must have a fixed-height for IE5.5+/win

Very interesting, thanks for sharing this one.
One thing I noticed, while experimenting with it in IE Mac: the 
centring is very much dependent of the font-family in use.

Explicitely specifying a font-family such as font-family:courrier, 
monospace; for the container, and then giving the container a font-size 
equal to the height of the container seems more reliable [1].
Not tested in IE Win yet.
my test file

[1] additionally, I gave the container a line-height of 100% - I don't 
think this should affect anything, in this case.

Philippe Wittenbergh
now live : <>
code | design | web projects : <>
IE5 Mac bugs and oddities : <>

css-discuss [EMAIL-REMOVED]]
List wiki/FAQ --
Supported by --
Previous Message
Next Message

Message thread: