navbar html css || navbar css html code || navbar hover line || navbar html


In this video, I tell about how to create a sticky navbar with a logo. I also tell about how to use the hover effects class deeply. I tell about how to create navbar hove line effects with animation. So watch the video completely ...


HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,
initial-scale=1.0">
<link rel="stylesheet" href="style.css">
<title>hover navbar</title>
</head>
<body>
<header>
<div class="container clearfix">
    <h1 class="logo"><a href="#">LOGO</a></h1>
<nav class="main-nav">
<ul>
   <li><a href="#">Home</a></li>
    <li><a href="#">About</a></li>
    <li><a href="#">Services</a></li>
    <li><a href="#">Contact</a></li>
</ul>
    </nav>
    </div>
</header>
</body>
</html>

CSS

*
{
    margin: 0;
    padding: 0;
}
a{
    text-decoration: none;
}
html{
    box-sizing: border-box;
}
*,*::before,*::after{
    box-sizing: inherit;
}
.clearfix::before,
.clearfix::after
{
    content: '';
    display: flex;
}
.clearfix::after
{
    clear: both;
}
ul,li{
    margin: 0;
    padding: 0;
}
li{
    list-style: none;
}
.container
{
    max-width: 1200px;
    width: 80%;
    margin: 0 auto;
}

/* main css statrt */
header
{
    background: #55d6ae;
    padding: 15px 0;
}
.logo
{
    float: left;
    /* padding: 10px 0; */
}
.logo a{
    color: #fff;
}
.main-nav
{
    float: right;
}
.main-nav li {
    display: inline-block;
    padding-left: 30px;
}
.main-nav li a{
    color: #fff;
    font-size: 14px;
    text-transform: uppercase;
    display: inline-block;
    padding: 10px 0;
    position: relative;
   
  }
  .main-nav li a::before {
    content: '';
    display: block;
    height: 3px;
    background-color: #444;
    position: absolute;
    top: 0;
    width: 0%;
    transition: all 0.3s ease-in-out;
  }
  .main-nav li a:hover::before {
    width: 100%;
  }
 
  .main-nav li a::after {
    content: '';
    display: block;
    height: 3px;
    background-color: #444;
    position: absolute;
    bottom: 0;
    width: 0%;
    transition: all 0.3s ease-in-out;
  }
  .main-nav li a:hover::after {
    width: 100%;
  }


Just copy it on your project 
And Don't forget to Subscribe To my youtube channel link 

Subscribe me

Previous Post Next Post

Contact Form