Posted By

Dydric on 03/10/08


Tagged

div center align


Versions (?)

Who likes this?

4 people have marked this snippet as a favorite

SmpleJohn
basicmagic
errortipo11
jasonseney


Center Div


 / Published in: CSS
 

  1. <html>
  2. <head>
  3. <title>Center</title>
  4.  
  5. <style type="text/css">
  6. body{background:red;}
  7.  
  8. div#centered {
  9. background: white;
  10. position: absolute;
  11. width: 700px;
  12. height: 300px;
  13. left: 50%;
  14. top: 50%;
  15. margin-left: -350px;
  16. margin-top: -150px;}
  17. </style>
  18.  
  19. </head>
  20.  
  21. <body>
  22. <div id="centered">This div is centered</div>
  23. </body>
  24. </html>

Report this snippet  

You need to login to post a comment.