I am trying to overwrite color values in the navigation bar and just can’t get it to work. I must be doing something wrong. I defined the classes active and inactive to change colors in the navigation.
index.html
<!doctype html>
<html lang="en">
<head>
<title>Hello, world!</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="author" content="WDieter Reuther">
<meta name="description" content="Testing CSS">
<!-- Favicon -->
<link rel="shortcut icon" href="assets/images/favicon.png">
<!-- Bootstrap -->
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH" crossorigin="anonymous">
<!-- Customization -->
<link rel="stylesheet" type="text/css" href="assets/css/custom.css">
</head>
<body>
<header class="navbar-light navbar-sticky header-static">
<nav class="navbar navbar-expand-lg bg-body-tertiary">
<div class="container-fluid" style="background-color: #27a800;">
<a class="navbar-brand" href="#">Navbar</a>
<div class="collapse navbar-collapse" id="navbarNavDropdown">
<ul class="navbar-nav">
<li class="nav-item">
<a class="nav-link active" aria-current="page" href="/">Home</a>
</li>
<li class="nav-item">
<a class="nav-link inactive" href="/page1.html">Page 1</a>
</li>
<li class="nav-item">
<a class="nav-link inactive" href="/page2.html">Page 2</a>
</li>
</ul>
</div>
</div>
</nav>
</header>
<h1>Hello, world!</h1>
</body>
</html>`
custom.css
@charset "UTF-8";
/*!
Custome Styling
*/
.inactive {color: #ffffff !important; }
.active {color: #333333 !important; }
I was expecting that my custom css colors would overwrite the bootstrap colors. They don’t.
I also would be happy if I could change the bootstrap colors, i.e. –bs-navbar-active-color via css.