06-22-table-display-navbar-vertical-align.html 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <title>Navbar using inline block</title>
  6. <script src="js/html5shiv.min.js"></script>
  7. <style>
  8. nav {
  9. display: block;
  10. }
  11. .navbar ul {
  12. font-family: 'Avenir Next', Avenir, Corbel, 'Franklin Gothic', 'Century Gothic', CenturyGothic, AppleGothic, sans-serif;
  13. list-style: none;
  14. padding: 0;
  15. background-color: #486a8e;
  16. display: table;
  17. table-layout: fixed;
  18. width: 100%;
  19. height: 100px;
  20. }
  21. .navbar li {
  22. display: table-cell;
  23. text-transform: uppercase;
  24. text-align: center;
  25. width: 25%;
  26. -moz-box-sizing: border-box;
  27. box-sizing: border-box;
  28. background-color: #12459e;
  29. outline: 1px solid #fff;
  30. vertical-align: middle;
  31. }
  32. .navbar li a {
  33. display: block;
  34. text-decoration: none;
  35. line-height: 1.75em;
  36. padding: 1em;
  37. color: #fff;
  38. }
  39. </style>
  40. </head>
  41. <body>
  42. <nav class="navbar">
  43. <ul>
  44. <li><a href="/home">Home</a></li>
  45. <li><a href="/spaceships">Spaceships</a></li>
  46. <li><a href="/planets">Planets</a></li>
  47. <li><a href="/stars">Stars</a></li>
  48. </ul>
  49. </nav>
  50. </body>
  51. </html>