06-20-inline-block-navbar-broken.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 — broken</title>
  6. <script src="js/html5shiv.min.js"></script>
  7. <style>
  8. /* force the nav-element to display as block in older non-HTML5 supporting
  9. browsers (like IE8) */
  10. nav {
  11. display: block;
  12. }
  13. .navbar ul {
  14. font-family: 'Avenir Next', Avenir, Corbel, 'Franklin Gothic', 'Century Gothic', CenturyGothic, AppleGothic, sans-serif;
  15. list-style: none;
  16. padding: 0;
  17. background-color: #486a8e;
  18. }
  19. .navbar li {
  20. text-transform: uppercase;
  21. display: inline-block;
  22. text-align: center;
  23. width: 25%;
  24. -moz-box-sizing: border-box;
  25. box-sizing: border-box;
  26. background-color: #12459e;
  27. outline: 1px solid #fff;
  28. }
  29. .navbar li a {
  30. display: block;
  31. text-decoration: none;
  32. line-height: 1.75em;
  33. padding: 1em;
  34. color: #fff;
  35. }
  36. </style>
  37. </head>
  38. <body>
  39. <nav class="navbar">
  40. <ul>
  41. <li><a href="/home">Home</a></li>
  42. <li><a href="/spaceships">Spaceships</a></li>
  43. <li><a href="/planets">Planets</a></li>
  44. <li><a href="/stars">Stars</a></li>
  45. </ul>
  46. </nav>
  47. </body>
  48. </html>