W3C home > Mailing lists > Public > www-style@w3.org > November 2001

How to vertical align an image?

From: Thomas Watson <w@tson.dk>
Date: Sun, 11 Nov 2001 17:22:16 +0100
To: <www-style@w3.org>
Message-ID: <000c01c16acd$0a7b7eb0$6b0110ac@ntvcom.dk>
I have a XHTML page (v1.1) where I have only one image. I want this
image to be displayed in the middle of the browser (both horisontal an
vertical aligned that is). 

This is my document type:
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

And this is how I try to position my image:
<div style="height: 100%; text-align: center;">
	<img src="ddjalogo.gif" width="640" height="329" alt="" />
</div>

My style attribute on the div-tag only has a height and a text-align.
The text-align style centers the image horisontaly. But how to I center
the image verticaly?

I've been searching the web for quite some time now without even finding
documents about this problem. Am I missing something here? Or is there
no way at all to do this?

- Hope some of you can help me :)

/watson
Received on Sunday, 11 November 2001 11:20:13 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 27 April 2009 13:54:11 GMT