|
| 1 | +body { |
| 2 | + overflow-x: hidden; |
| 3 | + font-family: Sans-Serif; |
| 4 | + margin: 0; |
| 5 | +} |
| 6 | + |
| 7 | +.menu-container { |
| 8 | + position: relative; |
| 9 | + display: flex; |
| 10 | + align-items: center; |
| 11 | + margin-bottom: 20px; |
| 12 | + background: #c04d4d; |
| 13 | + color: #ffffff; |
| 14 | + padding: 20px; |
| 15 | + z-index: 1; |
| 16 | + -webkit-user-select: none; |
| 17 | + user-select: none; |
| 18 | + box-sizing: border-box; |
| 19 | +} |
| 20 | + |
| 21 | +.menu-logo { |
| 22 | + line-height: 0; |
| 23 | + margin: 0 20px; |
| 24 | +} |
| 25 | + |
| 26 | +.menu-logo img { |
| 27 | + max-height: 40px; |
| 28 | + max-width: 100px; |
| 29 | + flex-shrink: 0; |
| 30 | +} |
| 31 | + |
| 32 | +.menu-container a { |
| 33 | + text-decoration: none; |
| 34 | + color: #c04d4d; |
| 35 | + transition: color 0.3s ease; |
| 36 | +} |
| 37 | + |
| 38 | +.menu-container a:hover { |
| 39 | + color: #50e3c2; |
| 40 | +} |
| 41 | + |
| 42 | +.menu-container input { |
| 43 | + display: block; |
| 44 | + width: 35px; |
| 45 | + height: 25px; |
| 46 | + margin: 0; |
| 47 | + position: absolute; |
| 48 | + cursor: pointer; |
| 49 | + opacity: 0; /* hide this */ |
| 50 | + z-index: 2; /* and place it over the hamburger */ |
| 51 | + -webkit-touch-callout: none; |
| 52 | +} |
| 53 | + |
| 54 | +/* Burger menu */ |
| 55 | +.menu-container span { |
| 56 | + display: block; |
| 57 | + width: 33px; |
| 58 | + height: 4px; |
| 59 | + margin-bottom: 5px; |
| 60 | + position: relative; |
| 61 | + background: #ffffff; |
| 62 | + border-radius: 3px; |
| 63 | + z-index: 1; |
| 64 | + transform-origin: 4px 0px; |
| 65 | + transition: transform 0.5s cubic-bezier(0.77,0.2,0.05,1.0), |
| 66 | + background 0.5s cubic-bezier(0.77,0.2,0.05,1.0), |
| 67 | + opacity 0.55s ease; |
| 68 | +} |
| 69 | + |
| 70 | +.menu-container span:first-child { |
| 71 | + transform-origin: 0% 0%; |
| 72 | +} |
| 73 | + |
| 74 | +.menu-container span:nth-child(3) { |
| 75 | + transform-origin: 0% 100%; |
| 76 | +} |
| 77 | + |
| 78 | +.menu-container input:checked ~ span { |
| 79 | + opacity: 1; |
| 80 | + transform: rotate(45deg) translate(3px,-1px); |
| 81 | + background: #c04d4d; |
| 82 | +} |
| 83 | + |
| 84 | +.menu-container input:checked ~ span:nth-child(4) { |
| 85 | + opacity: 0; |
| 86 | + transform: rotate(0deg) scale(0.2, 0.2); |
| 87 | +} |
| 88 | + |
| 89 | +.menu-container input:checked ~ span:nth-child(3) { |
| 90 | + transform: rotate(-45deg) translate(-5px,11px); |
| 91 | +} |
| 92 | + |
| 93 | +.menu ul { |
| 94 | + list-style: none; |
| 95 | +} |
| 96 | + |
| 97 | +.menu li { |
| 98 | + padding: 10px 0; |
| 99 | + font-size: 22px; |
| 100 | +} |
| 101 | + |
| 102 | +/* mobile styles */ |
| 103 | +@media only screen and (max-width: 767px) { |
| 104 | + .menu-container { |
| 105 | + flex-direction: column; |
| 106 | + align-items: flex-end; |
| 107 | + } |
| 108 | + |
| 109 | + .menu-logo { |
| 110 | + position: absolute; |
| 111 | + left: 0; |
| 112 | + top: 50%; |
| 113 | + transform: translateY(-50%); |
| 114 | + } |
| 115 | + |
| 116 | + .menu-logo img { |
| 117 | + max-height: 30px; |
| 118 | + } |
| 119 | + |
| 120 | + .menu { |
| 121 | + position: absolute; |
| 122 | + box-sizing: border-box; |
| 123 | + width: 300px; |
| 124 | + right: -300px; |
| 125 | + top: 0; |
| 126 | + margin: -20px; |
| 127 | + padding: 75px 50px 50px; |
| 128 | + background: #ffffff; |
| 129 | + -webkit-font-smoothing: antialiased; |
| 130 | + /* to stop flickering of text in safari */ |
| 131 | + transform-origin: 0% 0%; |
| 132 | + transform: translateX(0%); |
| 133 | + transition: transform 0.5s cubic-bezier(0.77,0.2,0.05,1.0); |
| 134 | + } |
| 135 | + |
| 136 | + .menu-container input:checked ~ .menu { |
| 137 | + transform: translateX(-100%); |
| 138 | + } |
| 139 | +} |
| 140 | + |
| 141 | +/* desktop styles */ |
| 142 | +@media only screen and (min-width: 768px) { |
| 143 | + .menu-container { |
| 144 | + width: 100%; |
| 145 | + } |
| 146 | + |
| 147 | + .menu-container a { |
| 148 | + color: #ffffff; |
| 149 | + } |
| 150 | + |
| 151 | + .menu-container input { |
| 152 | + display: none; |
| 153 | + } |
| 154 | + |
| 155 | + /* Burger menu */ |
| 156 | + .menu-container span { |
| 157 | + display: none; |
| 158 | + } |
| 159 | + |
| 160 | + .menu { |
| 161 | + position: relative; |
| 162 | + width: 100%; |
| 163 | + display: flex; |
| 164 | + justify-content: space-between; |
| 165 | + } |
| 166 | + |
| 167 | + .menu ul { |
| 168 | + display: flex; |
| 169 | + padding: 0; |
| 170 | + } |
| 171 | + |
| 172 | + .menu li { |
| 173 | + padding: 0 20px; |
| 174 | + } |
| 175 | +} |
0 commit comments