<body>
<section>
<h1>Heading</h1>
<p>Lorem ipsum dolor sit amet consectetur, adipisicing elit. Dolores ipsam officia pariatur laboriosam nam suscipit voluptas placeat nulla et? Quas commodi deserunt necessitatibus quisquam iusto aspernatur et, veniam provident ipsam?</p>
</section>
<!-- hamburger -->
<input type="checkbox" id="navi-toggle" class="checkbox" />
<label for="navi-toggle" class="button">
<span class="icon"> </span>
</label>
<div class="background"> </div>
<!-- nav -->
<nav class="nav">
<ul class="list">
<li class="item"> <a class="link"> Link 1 </a> </li>
<li class="item"> <a class="link"> Link 2 </a> </li>
<li class="item"> <a class="link"> Link 4 </a> </li>
<li class="item"> <a class="link"> Link 5 </a> </li>
<li class="item"> <a class="link"> Link 6 </a> </li>
</ul>
</nav
</body>
/* page styling */
body {
background: linear-gradient(90deg,#7bed9f, #3498db);
}
section {
max-width: 900px;
margin: 0 auto;
}
section h1 {
font-size: 46px;
text-align: center;
}
section p {
font-size: 26px;
text-align: center;
}
/* hamburger */
.checkbox {
display: none;
}
.button {
position: relative;
background-color: white;
height: 5rem;
width: 5rem;
border-radius: 50%;
position: fixed;
top: 5vh;
right: 5vw;
z-index: 2000;
box-shadow: 0 1rem 3rem black;
text-align: center;
cursor: pointer;
}
.background {
height: 4rem;
width: 4rem;
border-radius: 50%;
position: fixed;
top: 5.5vh;
right: 5.5vw;
background-image: radial-gradient(green, black);
z-index: 1000;
transition: transform 0.8s cubic-bezier(0.86, 0, 0.07, 1);
}
.nav {
height: 100vh;
position: fixed;
top: 0;
right: -60vw;
z-index: 1500;
opacity: 0;
width: 0;
transition: all 0.8s;
}
.list {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
list-style: none;
text-align: center;
width: 100%;
}
.item {
margin: 1rem;
font-size: 36px;
}
.link:link,
.link:visited {
display: inline-block;
font-size: 3rem;
font-weight: 300;
padding: 1rem 2rem;
color: white;
text-decoration: none;
text-transform: uppercase;
background-image: linear-gradient(
120deg,
transparent 0%,
transparent 50%,
white 50%
);
background-size: 220%;
transition: all 0.4s;
}
.link:hover,
.link:active {
color: lightgreen;
cursor: pointer;
}
/* functionality */
.checkbox:checked ~ .background {
transform: scale(80);
}
.checkbox:checked ~ .nav {
opacity: 1;
width: 100%;
right: 0;
}
/* */
/* styling hamb ICON */
.icon {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
.icon,
.icon::before,
.icon::after {
width: 3rem;
height: 2px;
background-color: gray;
display: inline-block;
}
.icon::before,
.icon::after {
content: "";
position: absolute;
left: 0;
transition: all 0.2s;
}
.icon::before {
top: -0.8rem;
}
.icon::after {
top: 0.8rem;
}
.button:hover icon:before {
top: -1rem;
}
.button:hover icon::after {
top: 1rem;
}
.checkbox:checked + .button .icon {
background-color: transparent;
}
.checkbox:checked + .button .icon::before {
top: 0;
transform: rotate(135deg);
}
.checkbox:checked + .button .icon::after {
top: 0;
transform: rotate(-135deg);
}
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.