vertical and horizontal centering with CSS


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



Copy this code and paste it in your HTML
  1. body {
  2. text-align:center;
  3. }
  4.  
  5. div.content {
  6. position:absolute;
  7. height:200px;
  8. width:500px;
  9. top:50%;
  10. left:50%;
  11. margin-top:-100px;
  12. margin-left:-250px;
  13. background:#000;
  14. }

URL: http://bettesmidler.com/code/2009-09-03.htm

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.