Hi there, I'm having an issue with my Bootstrap 4 navbar. When I test the responsiveness of my page, the background color of my nav-items disappears and only the text is visible. Can someone guide me on how to maintain the navbar color when I click the toggler link? Below is the HTML and CSS code I am using.
I want the navbar to resemble a dropdown menu with the same background color as the navbar.
*{
margin: 0;
padding: 0;
box-sizing: border-box;
}
body{
font-family: 'Poppins', sans-serif;
}
a{
text-decoration: none;
color: #555;
}
p{
color: #555;
}
.header{
background: radial-gradient(#fff,#ffd6d6);
}
.container{
max-width: 1300px;
margin: auto;
padding-left: 25px;
padding-right: 25px;
}
.navbar{
width: 100%;
height: 80px;
min-height:22px;
}
.navbar.navbar-inverse {
border: none;
}
.navbar .navbar-brand img {
height: 85px;
padding-left: 39%;
}
.navbar ul.navbar-nav li.nav-item a.nav-link {
color: #fff;
}
#navbarMenu{
align-items: flex-end;
padding-right: 5%;
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title></title>
<link rel="stylesheet" href="style.css">
<link rel="stylesheet" href="css/bootstrap.css">
<link href="https://cdn.jsdelivr.net/npm/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="8fede0e0fbfcfbfdeeffcfbaa1bfa1bfa2edeafbeebe">[email protected]</a>/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-giJF6kkoqNQ00vy+HMDP7azOuL0xtbfIcaT9wjKHr8RbDVddVHyTfAAsrekwKmP1" crossorigin="anonymous">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.0/umd/popper.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.1.0/js/bootstrap.min.js"></script>
</head>
<body>
<div class="header">
<div class="container">
<div class="navbar">
<nav class="navbar fixed-top navbar-toggleable-md navbar-inverse navbar-dark bg-danger navbar-expand-lg navbar-custom ">
<a href="#" class="navbar-brand">
Only Store
</a>
<button class="navbar-toggler btn btn-secondary" type="button" data-toggle="collapse" data-target="#navbarMenu" aria-controls="navbarMenu" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse justify-content-end" id="navbarMenu">
<ul class="navbar-nav mr-auto">
<li class="nav-item active">
<a href="#" class="nav-link">Home<span class="sr-only"></span> </a>
</li>
<li class="nav-item">
<a href="#" class="nav-link">Products</a>
</li>
<li class="nav-item">
<a href="#" class="nav-link">About</a>
</li>
<li class="nav-item">
<a href="#" class="nav-link">Contact</a>
</li>
<li class="nav-item">
<a href="#" class="nav-link">Account</a>
</li>
<li class="nav-item">
<a href="#" class="nav-link">
<img src="Images/cart.png" width="30px" height="30px">
<a href="javascript:void(0);" class="icon" onclick="menutoggle"></a>
<i class="fa fa-bars"></i>
</a>
</li>
</ul>
</div>
</nav>
</div>