Welcome to WebmasterWorld Guest from 23.22.140.143

Forum Moderators: not2easy

Message Too Old, No Replies

CSS for Verticle text centering

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

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Feb 21, 2001
posts:1281
votes: 0


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?
7:22 pm on Dec 31, 2002 (gmt 0)

Preferred Member

10+ Year Member

joined:Aug 28, 2002
posts:564
votes: 0


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.

 

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members