Make Beautiful Navbar using HTML & CSS
First of all create two files
1.
Index.html
2.
Style.CSS
3.
Download any image for using as a background
image
Sava all these files in a same folder.
Now open index.html file and create a simple HTML as
mentioned below.
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Navbar</title>
<link rel="stylesheet" href="style.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.1.1/css/all.min.css">
</head>
<body>
<nav>
<input type="checkbox" id="check">
<label for="check" class="checkbtn">
</label>
<label class="logo">EL
<ul>
<li><a href="">Home</a>
<li><a href="">About Us</a>
<li><a href="">Contact Us</a>
<li><a href="">Login</a>
</ul>
</nav>
</body>
</html>
*{
padding: 0;
margin: 0;
box-sizing: border-box;
}
body{
background: url(image/1.jpg) no-repeat;
background-size: cover;
height: 100vh;
}
nav{
width: 100%;
height: 80px;
background-color: blueviolet;
}
#check{
display: none;
}
.checkbtn{
float: right;
line-height: 80px;
color:white;
margin-right: 15px;
font-size: 24px;
display: none;
}
.logo{
font-size: 32px;
line-height: 80px;
color: white;
margin-left: 30px;
font-weight: bold;
}
nav ul{
float: right;
margin-right: 20px;
}
nav ul li{
list-style: none;
line-height: 80px;
display: inline-block;
margin: 5px 15px;
}
nav ul li a{
color:white;
text-decoration: none;
font-size: 18px;
text-transform: uppercase;
padding: 5px 10px;
}
a.active, a:hover{
background-color: rgb(57, 57, 128);
border-radius: 5px;
transition: .5s;
}
@media (max-width: 858px){
.checkbtn{
display: block;
margin-right: 20px;
font-size: 32px;
cursor: pointer;
}
nav ul{
position: fixed;
background: rgb(31, 22, 22);
width: 100%;
height: 100vh;
top: 80px;
left:-100%;
}
nav ul li {
display: block;
text-align: center;
}
a.active, a:hover{
background: none;
color:rgb(70, 70, 176);
transition: .5s;
}
#check:checked ~ ul{
left: 0;
transition: .5s;
}
}
It’s done you have successfully created Beautiful Responsive navbar using HTML and CSS
Here is
0 Comments