homepage Welcome to WebmasterWorld Guest from 54.145.182.50
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / CSS
Forum Library, Charter, Moderators: not2easy

CSS Forum

    
CSS for Verticle text centering
kapow

WebmasterWorld Senior Member 10+ Year Member



 
Msg#: 479 posted 6:54 pm on Dec 31, 2002 (gmt 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?

 

Longhaired Genius

10+ Year Member



 
Msg#: 479 posted 7:22 pm on Dec 31, 2002 (gmt 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.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / CSS
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved