Vertical and Horizontal Centering with CSS


/ Published in: CSS
Save to your folder(s)



Copy this code and paste it in your HTML
  1. .center {
  2. position: absolute;
  3. top:0; right:0; bottom:0; left:0;
  4. margin: auto;
  5.  
  6. left:expression(this.parentNode.clientWidth/2 - this.clientWidth/2 " px");
  7. top:expression(this.parentNode.clientHeight/2 - this.clientHeight/2 " px");
  8.  
  9. width: 60%;
  10. height: 60%;
  11. }

URL: http://valums.com/vertical/

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.