Centered block with unknown width


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

Applications:
1. Centered block with unknown width
2. Simple block which can have float style (f.e. horizontal menu)


Copy this code and paste it in your HTML
  1. CSS:
  2.  
  3. .menucenter {
  4. background:#e6eaff;
  5. border:#0dd 1px solid;
  6. margin:10px;
  7. height:30px;
  8. }
  9. .centermenu {float:left;position:relative;left:50%;}
  10. .cenmenu {position:relative;left:-50%;}
  11. *html .cenmenu {float:left;}
  12.  
  13. HTML:
  14.  
  15. <div class="menucenter">
  16. <div class="centermenu">
  17. <div class="cenmenu">
  18.  
  19. Menu (container) with float style
  20.  
  21. </div>
  22. </div>
  23. </div>

URL: http://trifler.ru/blog/post_1212599291.html

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.