Posted By

socreative on 01/13/10


Tagged

css center centered horizontal vertical


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

pogoretski


Horizontal and Vertical CSS Centering


 / Published in: CSS
 

  1. .centered { width: 300px;
  2. height: 304px;
  3. left: 50%;
  4. top: 50%;
  5. margin: -150px 0 0 -150px; /*-- halfs of the centered DIV height in width --*/
  6. position: fixed; }
  7.  
  8. * html .centered { position:absolute; } /*-- IE6 fix --*/

Report this snippet  

You need to login to post a comment.