Posted By

kanirasta on 10/21/08


Tagged

css xhtml layout


Versions (?)

Horizontally centering elements without width


 / Published in: CSS
 

URL: http://www.search-this.com/2007/09/19/when-is-a-float-not-a-float/

Add two containers to the element to be centered.

This is also needed for IE6:

1. 2. .navwrap ul{float:left;} 3. <![endif]-->

  1. 1.
  2. .navwrap{
  3. 2.
  4. float:left;
  5. 3.
  6. position:relative;
  7. 4.
  8. left:50%;
  9. 5.
  10. }
  11. 6.
  12. .navwrap ul{
  13. 7.
  14. position:relative;
  15. 8.
  16. left:-50%;
  17. 9.
  18. }

Report this snippet  

You need to login to post a comment.