Posted By

michellebracken on 08/18/11


Tagged


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

gteh


Vertical Centering Text with Line-Height


 / Published in: CSS
 

If you want to vertically center text within a containing block who’s height is fixed, simply set the line-height of the text to be the same as the height of the containing block

  1. The HTML:
  2. 1 some text here
  3.  
  4. The CSS:
  5. 1 div#container {
  6. 2 height: 35px;
  7. 3 line-height: 35px
  8. 4 }

Report this snippet  

You need to login to post a comment.