Dead Centre a DIV


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

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


Copy this code and paste it in your HTML
  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. }

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

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.