Advertisement
Flavio1234

menu responsivo hamburguer css

Jan 23rd, 2023
946
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
CSS 2.34 KB | None | 0 0
  1. .top-nav {
  2. display: flex;
  3. flex-direction: row;
  4. align-items: center;
  5. justify-content: space-between;
  6. /* W3C, IE 10+/ Edge, Firefox 16+, Chrome 26+, Opera 12+, Safari 7+ */
  7. color: rgb(202, 0, 0);
  8. height: 50px;
  9. padding: 1em;
  10. }
  11.  
  12. .menu {
  13. display: flex;
  14. flex-direction: row;
  15. list-style-type: none;
  16. margin: 0;
  17. padding: 0;
  18. visibility: hidden;
  19.  
  20. }
  21.  
  22. .menu > li {
  23. margin: 0 1rem;
  24. overflow: hidden;
  25.  
  26. }
  27.  
  28. .menu-button-container {
  29. display: none;
  30. height: 10%;
  31. width: 10px;
  32. cursor: pointer;
  33. flex-direction: column;
  34. justify-content: center;
  35. align-items: center;
  36. position:absolute;
  37. left:217px;
  38. top:114px;
  39. }
  40.  
  41. #menu-toggle {
  42. display: none;
  43.  
  44. }
  45.  
  46. .quadrado-hamburguer{
  47. background-color: #3d3d3d;
  48. width:40px;
  49. height: 40px;
  50. position:absolute;
  51. left:202px;
  52. top:129px;
  53. visibility: hidden;
  54. }
  55.  
  56. .menu-button,
  57. .menu-button::before,
  58. .menu-button::after {
  59. display: block;
  60. background-color: #ffffff;
  61. position: absolute;
  62. height:3px;
  63. width: 22px;
  64. transition: transform 400ms cubic-bezier(0.23, 1, 0.32, 1);
  65. border-radius: 2px;
  66.  
  67. }
  68.  
  69. .menu-button::before {
  70. content: '';
  71. margin-top: -7px;
  72. }
  73.  
  74. .menu-button::after {
  75. content: '';
  76. margin-top: 7px;
  77.  
  78. }
  79.  
  80. #menu-toggle:checked + .menu-button-container .menu-button::before {
  81. margin-top: 0px;
  82. transform: rotate(405deg);
  83.  
  84. }
  85.  
  86. #menu-toggle:checked + .menu-button-container .menu-button {
  87. background: rgba(255, 255, 255, 0);
  88. }
  89.  
  90. #menu-toggle:checked + .menu-button-container .menu-button::after {
  91. margin-top: 0px;
  92. transform: rotate(-405deg);
  93. }
  94.  
  95. .logo2{
  96. visibility: hidden;
  97. }
  98.  
  99. @media (max-width: 700px) {
  100. .menu-button-container {
  101. display: flex;
  102. }
  103.  
  104. .menu {
  105. position: absolute;
  106. top: 0;
  107. margin-top: 50px;
  108. left: 0;
  109. flex-direction: column;
  110. width: 100%;
  111. justify-content: center;
  112. align-items: center;
  113. visibility: visible;
  114. z-index: 999;
  115. position: absolute;
  116. top:120px;
  117. }
  118.  
  119. #menu-toggle ~ .menu li {
  120. height: 0;
  121. margin: 0;
  122. padding: 0;
  123. border: 0;
  124. transition: height 400ms cubic-bezier(0.23, 1, 0.32, 1);
  125.  
  126. }
  127.  
  128. #menu-toggle:checked ~ .menu li {
  129. border: 1px solid #333;
  130. height: 2.5em;
  131. padding: 0.5em;
  132. transition: height 400ms cubic-bezier(0.23, 1, 0.32, 1);
  133.  
  134.  
  135. }
  136.  
  137.  
  138. .menu > li {
  139. display: flex;
  140. justify-content: center;
  141. margin: 0;
  142. padding: 0.5em 0;
  143. width: 100%;
  144. color: white;
  145. background-color: #222;
  146.  
  147. }
  148.  
  149. .menu > li:not(:last-child) {
  150. border-bottom: 1px solid #444;
  151. }
  152. }
  153.  
  154.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement