I encountered an issue with my fixed navigation while using bootstrap 4. Everything works fine when hovering over non-active nav items, but it displays two bottom borders when hovering over the active nav item. I'm seeking assistance to resolve this issue. Thank you.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8>
<title>My Blog</title>
<!-- bootstrap.min.css -->
<link rel="stylesheet" type="text/css" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css">
<!-- google fonts -->
<link href="https://fonts.googleapis.com/css?family=Handlee" rel="stylesheet">
</head>
<body data-spy="scroll" data-target=".navbar">
<div class="container-fluid ">
<nav class="navbar fixed-top mainNavigation navbar-expand-lg navbar-light bg-light">
<a class="navbar-brand" href="#">Next World</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#homeNav" aria-controls="homeNav" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="homeNav">
<ul class="navbar-nav mr-auto ">
</ul>
<ul class="navbar-nav">
<li class="nav-item active">
<a class="nav-link" href="#home">Home <span class="sr-only">(current)</span></a>
</li>
<li class="nav-item">
<a class="nav-link" href="#about">About Us</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#team">Our Team</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#product">Our Product</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#services">Our Services</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#contact">Contact Us</a>
</li>
</ul>
</div>
</nav>
</div>
<!-- other -->
<div id="home" style="height: 500px;">Home</div>
<div id="about" style="height: 500px;">About</div>
<div id="team" style="height: 500px;">Team</div>
<div id="product" style="height: 500px;">Product</div>
<div id="services" style="height: 500px;">Services</div>
<div id="contact" style="height: 500px;">contact</div>
<!-- jquery link -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<!-- popper.js -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
<!-- bootstrap.min.js -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js"></script>
</body>
</html>
CSS code snippet:
.mainNavigation{
background-color: #fff !important;
font-family: 'Handlee', cursive;
font-size: 16px;
}
.nav-link{
color: rgb(165, 29, 43) !important;
}
.navbar-nav .nav-item{
padding-top: 1px;
cursor: pointer;
}
.navbar-nav .nav-item{
opacity: 0.5;
}
.navbar-nav .nav-item:hover {
opacity: 1;
border-bottom: solid 2px rgb(165, 29, 43);
padding-top: 0px;
border-radius: 1px;
transition-delay: 0.2s;
}
.navbar-nav .nav-item .active {
opacity: 1;
border-bottom: solid 2px rgb(165, 29, 43);
padding-top: 0px;
border-radius: 1px;
transition-delay: 0.2s;
}
You can also view the code on: https://jsfiddle.net/de_pes08/k12vgu3q/