Welcome to my website U-GINE MEDIA. In this website I teach tutorials and share source code on some programming (HTML, CSS & JavaScript) tutorials.
Before we get started, do well to subscribe to my channel to never miss out on any update that I post every single day.
In this tutorial topic "Create A CSS 3D Menu Navigation Bar | No JavaScript Using HTML", we will learn how to create it following these simple easy steps.
Share this to your programmer friends. If y'all learnt something today, make sure to let me in the comments.
If interested in watching the video before running the code below, you can click the play button to get started.
Code Begins
- First, create a folder with any name you like. Then, make the necessary files inside it.
- Create a file called index.html to serve as the main file.
- Create a file called style.css for the CSS code.
- Finally, go to Font Awesome and embed their cdnjs library link to your main file
To start, add the following HTML codes to your index.html file. These codes include essential HTML markup with different semantic tags, such as div, form, input, button, image, etc., to build the website layout.
<!DOCTYPE html>
<html lang="en">
<head>
<link rel="stylesheet" href="font-awesome.css">
<link rel="stylesheet" href="index.css">
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>CSS 3D Navigation Bar</title>
</head>
<body>
<ul>
<li style="--i:6;" data-icon=""><a href="#">Home</a></li>
<li style="--i:5;" data-icon=""><a href="#">About</a></li>
<li style="--i:4;" data-icon="ﬥ"><a href="#">Services</a></li>
<li style="--i:3;" data-icon=""><a href="#">Portfolio</a></li>
<li style="--i:2;" data-icon=""><a href="#">Our Team</a></li>
<li style="--i:1;" data-icon=""><a href="#">Contact</a></li>
</ul>
</body>
</html>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
min-height: 100vh;
display: flex;
justify-content: center;
align-items: center;
background: #222;
}
ul {
position: relative;
transform: skew(-15deg);
}
li {
position: relative;
list-style: none;
width: 200px;
padding: 15px;
background: #3e3f46;
z-index: calc(1 * var(--i));
transition: 0.5s;
}
li:hover {
background: #996fae;
transform: translateX(-50px);
}
li::before {
font-family: "FontAwesome";
color: #999;
display: flex;
justify-content: center;
align-items: center;
content: attr(data-icon);
position: absolute;
top: 0;
left: -40px;
width: 40px;
height: 100%;
background: #2e3133;
transform-origin: right;
transform: skewY(45deg);
transition: 0.5s;
}
li:hover::before {
background: #7b5190;
}
li::after {
content: "";
position: absolute;
top: -40px;
left: 0;
width: 100%;
height: 40px;
background: #35383e;
transform-origin: bottom;
transform: skewX(45deg);
transition: 0.5s;
}
li:hover::after {
background: #86539d;
}
li a {
text-decoration: none;
color: #999;
font-family: "Roboto";
display: block;
text-transform: uppercase;
letter-spacing: 0.05rem;
transition: 0.5s;
}
li:hover a {
color: #fff;
}
li:last-child::after {
box-shadow: -120px 120px 20px rgba(0,0,0,0.5);
}
0 Comments
We are happy to hear from you.