Posted By

saturngod on 03/09/10


Tagged

div css center


Versions (?)

Who likes this?

3 people have marked this snippet as a favorite

Triconium
cesgra
kubaitis


Div Center Horizontal and vertical


 / Published in: CSS
 

  1. #mydiv {
  2. position:absolute;
  3. top: 50%;
  4. left: 50%;
  5. width:30em;
  6. height:18em;
  7. margin-top: -9em; /*set to a negative number 1/2 of your height*/
  8. margin-left: -15em; /*set to a negative number 1/2 of your width*/
  9. border: 1px solid #ccc;
  10. background-color: #f3f3f3;
  11. }

Report this snippet  

You need to login to post a comment.