Welcome to WebmasterWorld Guest from

Forum Moderators: not2easy

Message Too Old, No Replies

CSS for Verticle text centering



6:54 pm on Dec 31, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member

Is it possible to centre text vertically in a div? I have a header div and would like the text to have the same spacing above and below. I know I can do it with padding-top but is there a nice CSS command to do this automatically?

Longhaired Genius

7:22 pm on Dec 31, 2002 (gmt 0)

10+ Year Member

To do what you want in a div you would have to use padding-top and padding-bottom.

There is a CSS property "vertical-align" which has two meanings:
On a table cell it will give the behaviour you describe.
The other use is to adjust the position of inline elements up or down relative to the rest of the line.


Featured Threads

Hot Threads This Week

Hot Threads This Month