Posted By

1man on 07/05/06


Tagged

css


Versions (?)

Last Edited at 07/05/06 10:02am

Viewed 204 times

Dead Centre a DIV


/ Published in: CSS

URL: http://www.wpdfd.com/editorial/thebox/deadcentre4.html

Taken from Dead Centre. Adjust #content depending on the size div you need.

  1. body
  2. {
  3. margin: 0px
  4. }
  5.  
  6. #horizon
  7. {
  8. color: white;
  9. background-color: #0ff;
  10. text-align: center;
  11. position: absolute;
  12. top: 50%;
  13. left: 0px;
  14. width: 100%;
  15. height: 1px;
  16. overflow: visible;
  17. visibility: visible;
  18. display: block
  19. }
  20.  
  21. #content
  22. {
  23. position: absolute;
  24. left: 50%;
  25. width: 250px; /* Overall width of div */
  26. height: 70px; /* Overall height of div */
  27. top: -35px; /* half of the overall height */
  28. margin-left: -125px; /* half of the overall width */
  29. visibility: visible
  30. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.