ph4x35ccb

menu animado hanburguer html css

Mar 27th, 2020
186
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.45 KB | None | 0 0
  1. <html>
  2. <head>
  3. <title>Menu de navegação</title>
  4. <link rel="stylesheet" href="estilo.css">
  5. </head>
  6. <body>
  7. <section id="banner">
  8.  
  9. <div>
  10. <img src="https://www.multylog.com.br/assets/images/ecologia.png" alt="Logotipo">
  11. </div>
  12. <input type="checkbox" id="menu-hanburguer">
  13. <label for="menu-hanburguer">
  14. <div class="menu">
  15. <span class="hanburguer"></span>
  16. </div>
  17. </label>
  18. <ul>
  19. <li><a href="">Home</a></li>
  20. <li><a href="">Serviços</a></li>
  21. <li><a href="">Sobre</a></li>
  22. <li><a href="">Contato</a></li>
  23. </ul>
  24.  
  25. </section>
  26.  
  27. <script src="script.js">
  28.  
  29. </script>
  30. </body>
  31. </html>
  32. /// CSS
  33. *{
  34. margin: 0;
  35. padding: 0;
  36. box-sizing: border-box;
  37. }
  38. body{
  39. background-color: #F5DEB3;
  40. }
  41. #banner{
  42. display: grid;
  43. justify-content: center;
  44. align-content: center;
  45. margin-top: 10%;
  46. }
  47. .menu{
  48. background-color: #DAA520;
  49. width: 65px;
  50. height: 65px;
  51. border-radius: 50%;
  52. bottom: 25px;
  53. right: 25px;
  54. position: fixed;
  55. cursor: pointer;
  56. box-shadow: 0 0 0 0 #DAA520, 0 0 0 0 #DAA520;
  57. transition: box-shadow 1s ease-in-out;
  58. }
  59. .hanburguer{
  60. position: relative;
  61. display: block;
  62. width: 40px;
  63. height: 3px;
  64. background-color: #fff;
  65. top: 32px;
  66. left: 13px;
  67. transition: .5s ease-in-out;
  68.  
  69. }
  70. #menu-hanburguer{
  71. display: none;
  72. }
  73. .menu:hover{
  74. box-shadow: 0 0 0 8px #DAA520, 0 0 0 8px #DAA520;
  75. }
  76. input:checked ~ ul{
  77. opacity: 1;
  78. transition: .2s 1s ease-in-out;
  79. }
  80. input:checked ~ label .hanburguer{
  81. transform: rotate(45deg);
  82. }
  83. input:checked ~ label .hanburguer:before{
  84. transform: rotate(90deg);
  85. top: 0px;
  86. }
  87. input:checked ~ label .hanburguer:after{
  88. transform: rotate(90deg);
  89. bottom: 0px;
  90. }
  91. input:checked ~ label .menu{
  92. box-shadow: 0 0 0 130vw #DAA520, 0 0 0 130vw #DAA520;
  93. }
  94. .hanburguer:before,
  95. .hanburguer:after{
  96. background-color: #fff;
  97. content: '';
  98. display: block;
  99. width: 100%;
  100. height: 100%;
  101. position: absolute;
  102. transition: .5s ease-in-out;
  103. }
  104. .hanburguer:before{
  105. top: -10px;
  106. }
  107. .hanburguer:after{
  108. bottom: -10px;
  109. }
  110. ul{
  111. position: absolute;
  112. top: 30%;
  113. left: 45%;
  114. transform: translate(-50% -50%);
  115. list-style: none;
  116. opacity: 0;
  117. transition: 1s;
  118. }
  119. a{
  120. display: block;
  121. margin-bottom: 30px;
  122. color: #fff;
  123. font-size: 40px;
  124. text-decoration: none;
  125. font-weight: 900;
  126. font-family: "Trebuchet MS";
  127. }
Advertisement
Add Comment
Please, Sign In to add comment