Advertisement
Guest User

Untitled

a guest
Aug 22nd, 2017
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.71 KB | None | 0 0
  1. <!doctype html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <title></title>
  6. <style>
  7. body {
  8. font-family: sans-serif;
  9. }
  10. h2 {
  11. font-size: 2em;
  12. margin-bottom: 0;
  13. }
  14. /* Menuleiste */
  15. ul {
  16. padding: 0;
  17. list-style-type: none;
  18. max-width: 800px;
  19. }
  20. li {
  21. display: inline-block;
  22. width:25%;
  23. text-align: center;
  24. height: 30px;
  25. line-height: 30px;
  26. }
  27. a {
  28. color: white;
  29. text-decoration: none;
  30. }
  31.  
  32. /* Farben der Menuleiste */
  33. #ver1 ul{
  34. background: darkred;
  35. }
  36. #ver1 li:hover {
  37. background: red;
  38. }
  39.  
  40. #ver2 ul{
  41. background: darkblue;
  42. }
  43. #ver2 li:hover {
  44. background: blue;
  45. }
  46. /* Menuschalter */
  47. .hamburger {
  48. display: none;
  49. position: relative;
  50. width: 96px;
  51. height:96px;
  52. margin: 0;
  53. padding:0;
  54. font-size: 0;
  55. text-indent: -99999px;
  56. cursor: pointer;
  57. }
  58. .hamburger span {
  59. display: block;
  60. position: absolute;
  61. top: 44px;
  62. left: 18px;
  63. right: 18px;
  64. height: 8px;
  65. background: white;
  66. transition: all 300ms;
  67. }
  68.  
  69. .hamburger span::before,
  70. .hamburger span::after {
  71. content: "";
  72. display: block;
  73. position: absolute;
  74. width: 100%;
  75. left: 0px;
  76. height: 8px;
  77. background: white;
  78. }
  79. .hamburger span::before {
  80. top: -20px;
  81. }
  82. .hamburger span::after {
  83. bottom: -20px;
  84. }
  85. #ver1check,
  86. #ver2check {
  87. display: none;
  88. }
  89.  
  90. /* Farben der Menuschalters */
  91. #ver1 .hamburger {
  92. background: darkred;
  93. }
  94. #ver2 .hamburger {
  95. background: darkblue;
  96. }
  97.  
  98. /* Funktionalität & Animation */
  99. @media (max-width: 600px) {
  100. li {
  101. display: none;
  102. height: 60px;
  103. line-height: 60px;
  104. font-size: 2em;
  105. width: 100%
  106. }
  107.  
  108. .hamburger {
  109. display: block;
  110. }
  111.  
  112. #ver1check:checked ~ ul li {
  113. display: block;
  114. }
  115. #ver1check:checked ~ label .hamburger {
  116. background: red;
  117. }
  118. #ver1check:checked ~ label .hamburger span {
  119. transform: rotate(90deg);
  120. }
  121.  
  122. #ver2 label .hamburger span {
  123. transition: background 0s 300ms;
  124. }
  125. #ver2 label .hamburger span::before,
  126. #ver2 label .hamburger span::after{
  127. transition: top 300ms 300ms, bottom 300ms 300ms, transform 300ms 0ms;
  128. }
  129.  
  130. #ver2check:checked ~ ul li {
  131. display: block;
  132. }
  133. #ver2check:checked ~ label .hamburger {
  134. background: blue;
  135. }
  136. #ver2check:checked ~ label .hamburger span {
  137. background: none;
  138. }
  139. #ver2check:checked ~ label .hamburger span::before {
  140. top:0;
  141. transform: rotate(45deg);
  142. transition: top 300ms 0ms, transform 300ms 300ms;
  143. }
  144. #ver2check:checked ~ label .hamburger span::after {
  145. bottom:0;
  146. transform: rotate(-45deg);
  147. transition: bottom 300ms 0ms, transform 300ms 300ms;
  148. }
  149.  
  150. }
  151.  
  152.  
  153. </style>
  154. </head>
  155. <body>
  156. <h2>Menu 1 Test</h2>
  157. <nav id="ver1">
  158. <input type="checkbox" id="ver1check">
  159. <label for="ver1check">
  160. <span class="hamburger">
  161. <span>toggle menu</span>
  162. </span>
  163. </label>
  164. <ul>
  165. <li><a href="#">Menupunkt 1</a>
  166. <li><a href="#">Menupunkt 2</a>
  167. <li><a href="#">Menupunkt 3</a>
  168. <li><a href="#">Menupunkt 4</a>
  169. </ul>
  170. </nav>
  171. <h2>Menu 2 Test</h2>
  172. <nav id="ver2">
  173. <input type="checkbox" id="ver2check">
  174. <label for="ver2check">
  175. <span class="hamburger">
  176. <span>toggle menu</span>
  177. </span>
  178. </label>
  179. <ul>
  180. <li><a href="#">Menupunkt 1</a>
  181. <li><a href="#">Menupunkt 2</a>
  182. <li><a href="#">Menupunkt 3</a>
  183. <li><a href="#">Menupunkt 4</a>
  184. </ul>
  185. </nav>
  186. </body>
  187. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement