You are here

sm-menu-toggle.css in Smartmenus.js 7

Same filename and directory in other branches
  1. 8 css/sm-menu-toggle.css
/*
 * @file
 * CSS for the responsive menu toggle checkbox / button.
 */
.sm-menu-btn {
  position: relative;
  display: inline-block;
  width: 28px;
  height: 28px;
  text-indent: 28px;
  white-space: nowrap;
  overflow: hidden;
  cursor: pointer;
  -webkit-tap-highlight-color: rgba(0,0,0,0);
}

/* hamburger icon */
.sm-menu-btn-icon,
.sm-menu-btn-icon:before,
.sm-menu-btn-icon:after {
  position: absolute;
  top: 50%;
  left: 2px;
  height: 2px;
  width: 24px;
  background: #bbb;
  -webkit-transition: all 0.25s;
  transition: all 0.25s;
}
.sm-menu-btn-icon:before {
  content: '';
  top: -7px;
  left: 0;
}
.sm-menu-btn-icon:after {
  content: '';
  top: 7px;
  left: 0;
}

/* x icon */
.sm-menu-state:checked ~ .sm-menu-btn .sm-menu-btn-icon {
  height: 0;
  background: transparent;
}
.sm-menu-state:checked ~ .sm-menu-btn .sm-menu-btn-icon:before {
  top: 0;
  -webkit-transform: rotate(-45deg);
  transform: rotate(-45deg);
}
.sm-menu-state:checked ~ .sm-menu-btn .sm-menu-btn-icon:after {
  top: 0;
  -webkit-transform: rotate(45deg);
  transform: rotate(45deg);
}

/* hide menu state checkbox (keep it visible to screen readers) */
.sm-menu-state {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  border: 0;
  padding: 0;
  overflow: hidden;
  clip: rect(1px,1px,1px,1px);
}
/* hide the menu in mobile view */
.sm-menu-state:not(:checked) ~ .sm {
  display: none;
}
.sm-menu-state:checked ~ .sm {
  display: block;
}
@media (min-width: 768px) {
  /* hide the button in desktop view */
  .sm-menu-btn {
    position: absolute;
    top: -99999px;
  }
  /* always show the menu in desktop view */
  .sm-menu-state:not(:checked) ~ .sm {
    display: block;
  }
}

File

css/sm-menu-toggle.css
View source
  1. /*
  2. * @file
  3. * CSS for the responsive menu toggle checkbox / button.
  4. */
  5. .sm-menu-btn {
  6. position: relative;
  7. display: inline-block;
  8. width: 28px;
  9. height: 28px;
  10. text-indent: 28px;
  11. white-space: nowrap;
  12. overflow: hidden;
  13. cursor: pointer;
  14. -webkit-tap-highlight-color: rgba(0,0,0,0);
  15. }
  16. /* hamburger icon */
  17. .sm-menu-btn-icon,
  18. .sm-menu-btn-icon:before,
  19. .sm-menu-btn-icon:after {
  20. position: absolute;
  21. top: 50%;
  22. left: 2px;
  23. height: 2px;
  24. width: 24px;
  25. background: #bbb;
  26. -webkit-transition: all 0.25s;
  27. transition: all 0.25s;
  28. }
  29. .sm-menu-btn-icon:before {
  30. content: '';
  31. top: -7px;
  32. left: 0;
  33. }
  34. .sm-menu-btn-icon:after {
  35. content: '';
  36. top: 7px;
  37. left: 0;
  38. }
  39. /* x icon */
  40. .sm-menu-state:checked ~ .sm-menu-btn .sm-menu-btn-icon {
  41. height: 0;
  42. background: transparent;
  43. }
  44. .sm-menu-state:checked ~ .sm-menu-btn .sm-menu-btn-icon:before {
  45. top: 0;
  46. -webkit-transform: rotate(-45deg);
  47. transform: rotate(-45deg);
  48. }
  49. .sm-menu-state:checked ~ .sm-menu-btn .sm-menu-btn-icon:after {
  50. top: 0;
  51. -webkit-transform: rotate(45deg);
  52. transform: rotate(45deg);
  53. }
  54. /* hide menu state checkbox (keep it visible to screen readers) */
  55. .sm-menu-state {
  56. position: absolute;
  57. width: 1px;
  58. height: 1px;
  59. margin: -1px;
  60. border: 0;
  61. padding: 0;
  62. overflow: hidden;
  63. clip: rect(1px,1px,1px,1px);
  64. }
  65. /* hide the menu in mobile view */
  66. .sm-menu-state:not(:checked) ~ .sm {
  67. display: none;
  68. }
  69. .sm-menu-state:checked ~ .sm {
  70. display: block;
  71. }
  72. @media (min-width: 768px) {
  73. /* hide the button in desktop view */
  74. .sm-menu-btn {
  75. position: absolute;
  76. top: -99999px;
  77. }
  78. /* always show the menu in desktop view */
  79. .sm-menu-state:not(:checked) ~ .sm {
  80. display: block;
  81. }
  82. }