I am a newcomer to Bootstrap, and while trying to make a navbar more responsive for all screen sizes and add some effects, I somehow lost the background color of my navbar. I attempted to explicitly change the color by altering the navbar-light class, but it does not seem to be working.
The HTML:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<title>
Navbar
</title>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link
rel="stylesheet"
href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css"
integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm"
crossorigin="anonymous"
/>
<link rel="stylesheet" type="text/css" media="screen" href="main.css" />
<script src="main.js"></script>
</head>
<body>
<header class="header_area">
<div class="main_menu">
<nav class="navbar navbar-expand-lg navbar-light">
<div class="container box_1620">
<a class="navbar-brand logo_h" href="index.html"><h2>Brand</h2></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="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<div
class="collapse navbar-collapse offset"
id="navbarSupportedContent"
>
<ul class="nav navbar-nav menu_nav ml-auto">
<li class="nav-item active">
<a class="nav-link" href="index.html">Home</a>
</li>
<li class="nav-item">
<a class="nav-link" href="about.html">About Us</a>
</li>
<li class="nav-item">
<a class="nav-link" href="pricing.html">Pricing</a>
</li>
<li class="nav-item">
<a class="nav-link" href="gallery.html">Gallery</a>
</li>
<li class="nav-item">
<a class="nav-link" href="contact.html">Contact</a>
</li>
</ul>
</div>
</div>
</nav>
</div>
</header>
<script
src="https://code.jquery.com/jquery-3.2.1.slim.min.js"
integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN"
crossorigin="anonymous"
></script>
<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>
<script
src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js"
integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl"
crossorigin="anonymous"
></script>
</body>
</html>
The CSS:
.header_area {
padding: 0px;
border: 0px;
border-width: 0px;
position: absolute;
width: 100%;
top: 0;
left: 0;
z-index: 99;
-webkit-transition: background 0.4s, all 0.3s linear;
-o-transition: background 0.4s, all 0.3s linear;
transition: background 0.4s, all 0.3s linear;
}
.header_area .navbar {
padding: 0px;
border: 0px;
border-width: 0px;
}
.header_area .navbar .nav .nav-item {
margin-right: 45px;
}
.header_area .navbar .nav .nav-item .nav-link {
font: 500 12px/100px "Roboto", sans-serif;
text-transform: uppercase;
color: #222222;
padding: 0px;
display: inline-block;
}
...
(Continues with CSS styling)
.header_area + section,
.header_area + row,
.header_area + div {
margin-top: 100px;
}
.header_area.navbar_fixed .main_menu {
position: fixed;
width: 100%;
top: -70px;
left: 0;
right: 0;
background: #fff;
-webkit-transform: translateY(70px);
-ms-transform: translateY(70px);
transform: translateY(70px);
-webkit-transition: background 500ms ease, -webkit-transform 500ms ease;
...
(Continues with styling)
I am seeking guidance on why this issue occurred, where I may have made a mistake, and potential solutions to rectify the problem.