06-35-flexbox-navbar-align-baseline.html 1.5 KB

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