"Navbar Hover Effect with Bootstrap 4.4.1"
Bootstrap 4.1.1 Snippet by limon

<link href="//maxcdn.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css"> <script src="//maxcdn.bootstrapcdn.com/bootstrap/4.1.1/js/bootstrap.min.js"></script> <script src="//cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> <!------ Include the above in your HEAD tag ----------> <!doctype html> <html lang="en"> <head> <!-- Required meta tags --> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> <!-- Bootstrap CSS --> <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css"> <link rel="stylesheet" href="assets/css/style.css"> <title>Hello, world!</title> </head> <body> <!-- nav-bar-area-start --> <nav class="navbar navbar-expand-lg navbar-light bg-light"> <div class="container"> <!-- ====================nav-left-site==================== --> <a class="navbar-brand" href="#">Navbar</a> <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation"> <span class="navbar-toggler-icon"></span> </button> <!-- ====================nav-middle-site==================== --> <div class="collapse navbar-collapse" id="navbarSupportedContent"> <ul class="navbar-nav m-auto"> <li class="nav-item active"> <a class="nav-link" href="#">Home</a> </li> <li class="nav-item"> <a class="nav-link" href="#">About Us</a> </li> <li class="nav-item"> <a class="nav-link" href="#">Our Work</a> </li> <li class="nav-item"> <a class="nav-link" href="#">Gallery</a> </li> <li class="nav-item"> <a class="nav-link" href="#">Contact Us</a> </li> </ul> <!-- ====================nav-right-site==================== --> <ul class="navbar-nav my-2 my-lg-0"> <button class="btn btn-outline-success my-2 my-sm-0" type="submit">Log In</button> </ul> </div> </div> </nav> <!-- jQuery first, then Popper.js, then Bootstrap JS --> <script src="https://code.jquery.com/jquery-3.4.1.slim.min.js"></script> <script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js"></script> <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js"></script> </body> </html>
/*author: Limon*/ .navbar-nav .nav-link { position: relative; } .navbar-nav .nav-link:hover, .navbar-nav .nav-link.active { color: #ff7700; } .navbar-nav .nav-link::before { content: ""; position: absolute; background: #ff7700; width: 48%; bottom: 0; left: -48%; z-index: 0; transition: 0.6s; } .navbar-nav .nav-link::after { content: ""; position: absolute; background: #ff7700; width: 48%; bottom: 0; height: 0; right: -48%; z-index: 0; transition: 0.6s; } .navbar-nav .nav-link:hover::before, .navbar-nav .nav-link.active::before { height: 2px;left: 5%; transition: 0.6s; } .navbar-nav .nav-link:hover::after, .navbar-nav .nav-link.active::after { height: 2px;right: -5%; transition: 0.6s; }

Related: See More


Questions / Comments: