Posted By

1man on 02/03/11


Tagged

menu width list centre


Versions (?)

Who likes this?

2 people have marked this snippet as a favorite

tmbrenneke
nehmmy


Vertically centre a menu without setting an explicit width


 / Published in: CSS
 

URL: http://csswizardry.com/2011/01/create-a-vertically-centred-horizontal-navigation/

Useful bit of CSS to vertically centre a navigation. Good for Pagination.

  1. <style type="text/css">
  2. #nav {
  3. margin: 0 auto;
  4. text-align: center;
  5. }
  6. #nav li {
  7. display: inline;
  8. vertical-align: middle;
  9. }
  10. #nav li a {
  11. display: inline-block;
  12. }
  13. </style>
  14.  
  15. <body>
  16. <ul id="nav">
  17. <li><a href="#"></a></li>
  18. <li><a href="#"></a></li>
  19. <li><a href="#"></a></li>
  20. <li><a href="#"></a></li>
  21. <li><a href="#"></a></li>
  22. </ul>
  23. </body>

Report this snippet  

You need to login to post a comment.