The content on this website, including videos and code examples, is for educational purposes only. All demonstrations and designs are fictional and created to illustrate coding techniques. Any resemblance to existing websites or brands is purely coincidental.
The creators and administrators of this website do not claim ownership or affiliation with any existing websites or companies. Users are encouraged to use the information responsibly for learning purposes. Liability for any misuse of the content provided is not accepted.
Below is the html code for this video.
index.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Morphing Transition Menu</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<div class="container">
<input type="checkbox" id="toggle">
<label for="toggle" class="toggle-container">
<span class="button button-toggle"></span>
</label>
<nav class="nav">
<a href="" class="nav-item">Home</a>
<a href="" class="nav-item">About</a>
<a href="" class="nav-item">Features</a>
<a href="" class="nav-item">Contact</a>
<a href="" class="nav-item">Login</a>
</nav>
<div class="content">
<p>Lorem ipsum dolor, sit amet consectetur adipisicing elit. Aliquid magnam delectus necessitatibus fuga.
Exercitationem placeat veniam deserunt ex fugit. Placeat nobis assumenda aspernatur quas accusantium
dolorem animi. Qui, iure optio?</p>
<p>Lorem, ipsum dolor sit amet consectetur adipisicing elit. Consequuntur expedita minus id similique atque,
asperiores praesentium officia cupiditate explicabo magnam tempore esse hic repellat alias quia, quo
maiores cumque dignissimos.</p>
</div>
</div>
</body>
</html>
Below is the css code for this video.
style.css
* {
margin: 0;
padding: 0;
box-sizing: border-box;
transition: all 0.5s ease;
}
body {
display: flex;
height: 100vh;
width: 100%;
background-color: #b284be;
font-family: sans-serif;
align-items: center;
justify-content: center;
}
a {
text-decoration: none;
}
.container {
position: relative;
height: 540px;
width: 304px;
background-color: #6a5acd;
background-image: linear-gradient(to bottom, #6a5acd, #c54b8c);
box-shadow: 0 0 25px #000000bf;
overflow: hidden;
}
#toggle {
position: absolute;
top: -100%;
left: -100%;
}
#toggle:checked~.toggle-container .button-toggle:hover, .button-toggle:hover {
box-shadow: 0 0 0 8px #0000001a, inset 0 0 0 20px #0000001a;
}
#toggle:checked~.toggle-container .button-toggle::before {
transform: translateY(-50%) rotate(45deg) scale(1);
}
#toggle:checked~.toggle-container .button-toggle::after {
transform: translateY(-50%) rotate(-45deg) scale(1);
}
#toggle:checked~.nav {
transform: translate(50px, 25px);
pointer-events: auto;
margin-bottom: 50px;
}
#toggle:checked~.nav .nav-item {
height: 40px;
color: #000000;
transform: scaleY(1);
line-height: 40px;
letter-spacing: 0;
opacity: 1;
}
#toggle:checked~.nav .nav-item:hover {
color: #ffffff;
}
#toggle:checked~.nav .nav-item:nth-child(1), #toggle:checked~.nav .nav-item:nth-child(1)::before, .nav-item:nth-child(4), .nav-item:nth-child(4)::before {
transition-delay: 0.15s;
}
#toggle:checked~.nav .nav-item:nth-child(2), #toggle:checked~.nav .nav-item:nth-child(2)::before, .nav-item:nth-child(3), .nav-item:nth-child(3)::before {
transition-delay: 0.1s;
}
#toggle:checked~.nav .nav-item:nth-child(3), #toggle:checked~.nav .nav-item:nth-child(3)::before, .nav-item:nth-child(2), .nav-item:nth-child(2)::before {
transition-delay: 0.05s;
}
#toggle:checked~.nav .nav-item:nth-child(4), #toggle:checked~.nav .nav-item:nth-child(4)::before, .nav-item:nth-child(1), .nav-item:nth-child(1)::before {
transition-delay: 0s;
}
#toggle:checked~.nav .nav-item::before {
opacity: 0;
}
#toggle:checked~.content {
padding-top: 30px;
}
#toggle:checked~.content::before {
background-color: #00000080;
}
#toggle:checked~.content p {
color: #ffffff80;
}
.button-toggle {
position: absolute;
display: inline-block;
height: 20px;
width: 20px;
background-color: transparent;
border: none;
border-radius: 50%;
margin: 25px;
cursor: pointer;
}
.button-toggle::before, .button-toggle::after {
content: "";
position: absolute;
top: 50%;
left: 0;
height: 2px;
width: 100%;
background-color: #000000;
border-radius: 4px;
}
.button-toggle::before {
transform: translateY(-50%) rotate(45deg) scale(0);
}
.button-toggle::after {
transform: translateY(-50%) rotate(-45deg) scale(0);
}
.nav {
display: inline-block;
pointer-events: none;
margin: 25px;
}
.nav-item {
position: relative;
display: block;
height: 7px;
color: transparent;
transform: scaleY(0.2);
font-size: 14px;
line-height: 7px;
letter-spacing: -6.25px;
text-transform: uppercase;
white-space: nowrap;
float: left;
clear: both;
}
.nav-item:nth-child(1) {
letter-spacing: -5px;
}
.nav-item:nth-child(2), .nav-item:nth-child(3) {
letter-spacing: -7px;
}
.nav-item:nth-child(n+4) {
margin-top: 7px;
letter-spacing: -8px;
opacity: 0;
}
.nav-item::before {
content: "";
position: absolute;
top: 50%;
left: 0;
height: 2px;
width: 100%;
background-color: #000000;
transform: translateY(-50%) scaleY(5);
}
.content {
position: relative;
text-align: center;
}
.content::before {
content: "";
position: absolute;
top: 0;
left: 0;
height: 100%;
width: 100%;
background-color: transparent;
z-index: 2;
}
.content p {
width: 85%;
text-align: justify;
line-height: 1.5;
margin: 5% auto;
}
Thanks for visiting