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:

> http://mrclay.org/web_design/centered_image/
> * 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
<http://dev.l-c-n.com/misc/image_Center_V.php>

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

Philippe
---/---
Philippe Wittenbergh
now live : <http://emps.l-c-n.com/>
code | design | web projects : <http://www.l-c-n.com/>
IE5 Mac bugs and oddities : <http://www.l-c-n.com/IE5tests/>

______________________________________________________________________
css-discuss [EMAIL-REMOVED]]
http://www.css-discuss.org/mailman/listinfo/css-d
List wiki/FAQ -- http://css-discuss.incutio.com/
Supported by evolt.org -- http://www.evolt.org/help_support_evolt/
Previous Message
Next Message

Message thread: