Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

hamburger-menu.css 2.0KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. .main-menu-button {
  2. display: none;
  3. }
  4. @media (max-width: 768px) {
  5. /* hide social media links in mobile view */
  6. .top-social-container {
  7. display: none
  8. }
  9. /* menu */
  10. .main-menu-list {
  11. clear: both;
  12. max-height: 0;
  13. transition: max-height 0.2s ease-out;
  14. }
  15. /* menu icon: middle bar */
  16. .main-menu-icon,
  17. .main-menu-icon:before,
  18. .main-menu-icon:after {
  19. background: lightblue;
  20. display: block;
  21. width: 30px;
  22. content: '';
  23. transition-duration: 0.2s;
  24. transition-timing-function: ease-out;
  25. }
  26. .main-menu-icon {
  27. height: 3px;
  28. position: relative;
  29. transition-property: background;
  30. }
  31. /* menu icon: add one bar below and one above -> hamburger style */
  32. .main-menu-icon:before,
  33. .main-menu-icon:after {
  34. height: 100%;
  35. position: absolute;
  36. transition-property: all;
  37. }
  38. .main-menu-icon:before { top: 10px; }
  39. .main-menu-icon:after { top: -10px; }
  40. /* limit the length of the menu item list */
  41. .main-menu-button:checked ~ .main-menu-list {
  42. max-height: 100%;
  43. }
  44. /* parallel -> crossing transition of hamburger menu icon */
  45. .main-menu-button:checked ~ .main-menu-label .main-menu-icon { background: transparent; }
  46. .main-menu-button:checked ~ .main-menu-label .main-menu-icon:before { transform: rotate(-45deg); }
  47. .main-menu-button:checked ~ .main-menu-label .main-menu-icon:after { transform: rotate(45deg); }
  48. .main-menu-button:checked ~ .main-menu-label:not(.steps) .main-menu-icon:before,
  49. .main-menu-button:checked ~ .main-menu-label:not(.steps) .main-menu-icon:after {
  50. top: 0;
  51. }
  52. .main-menu-label {
  53. display: inline-block;
  54. cursor: pointer;
  55. float: right;
  56. padding: 28px 20px;
  57. position: relative;
  58. user-select: none;
  59. }
  60. .main-menu-list {
  61. overflow: hidden;
  62. }
  63. .main-menu-list li {
  64. display: block;
  65. text-align: right;
  66. padding: 0.5rem;
  67. }
  68. /* reduce width of logo and place logo and hamburger menu on one line */
  69. .site-logo { display: inline; }
  70. .site-logo img { max-width: 70%; }
  71. .main-menu-container { display: inline; }
  72. }