PDA

View Full Version : Vertical Alignment in DIV Layer


Firefly3000
29th September 06, 09:23 AM
How can I vertically align text in a div layer?

Jen
29th September 06, 10:26 AM
vertical-align: middle;

Step 3 — Multiple lines vertical-align:middle
This must be the trickiest part of the vertical-align functionality to be achieved with CSS. If we were to just use the trick from Step2 and set the absolutely aligned div to top:50% or bottom:50%, this would align the top part of the text (or its baseline) at the middle — so its not really middle vertically aligned. We could use the actual vertical-align property but it only works for inline elements, so we should use display:table and display:table-cell for the enclosing divs.
By http://www.badboy.ro/articles/2005-02-20/index.php

Firefly3000
29th September 06, 12:44 PM
Hi Jen

Thanks, but it only seems to work in FF, has no affect in IE, plus I have lets say 4 divs below each other when I apply display: table-cell it arranges my divs horizontally. Is there any way to control the orientation? I also tried the same method with a UL, but get the same behaviour.

Jen
29th September 06, 04:59 PM
I never use that because it does not support IE. So try position: static; ? Or either search vertical align in google.