Centering body in browser window


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



Copy this code and paste it in your HTML
  1. HTML:
  2.  
  3. <body>
  4.  
  5. <div id="all-wrap">
  6. <div id="wrapper">
  7. <div id="body-wrapper">
  8.  
  9. // Everything
  10.  
  11. </div>
  12. </div>
  13. </div>
  14. </body>
  15.  
  16.  
  17. CSS:
  18.  
  19. #all-wrap {
  20. background-color: transparent;
  21. text-align: center;
  22. left: 0;
  23. width: 100%;
  24. height: 1px;
  25. overflow: visible;
  26. visibility: visible;
  27. display: block;}
  28.  
  29. #wrapper {
  30. position: absolute;
  31. top: -30px; left: 50%;
  32. visibility: visible;
  33. z-index: 1;
  34. margin-left: -647px;
  35. height: 928px;
  36. width: 1280px;
  37. background: url(../images/bg.jpg) 0 30px no-repeat;}
  38.  
  39. #body-wrapper {
  40. position: relative;
  41. z-index: 1;
  42. height: auto;
  43. width: 1280px;
  44. float: left;}

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.