How can the issue of the navbar color not being able to disappear or turn transparent be resolved, given its connection to the body color?

@import url('https://fonts.googleapis.com/css2?family=Bai+Jamjuree:wght@400;500;600;700&display=swap');

:root {
    --color-body: #b6cbce;
    --color-heading: #eef3db;
    --color-base: #033f47;
    --color-base2: #022a30;
    --color-brand: #e0f780;
    --color-brand2: #deff58;
    --sidbar-width: 240px;
    --font-base: "Bai Jamjuree";
}

*{
    background-color: var(--color-base2);
    color: var(--color-base);
    font-family: var(--font-base);


}

.navbar .nav-link {
    font-weight: 700;
    text-transform: uppercase;
    color: white;
    transition:all 0.5s ease-in;
}

.navbar .nav-link:hover{
    color: var(--color-brand);
}

h1,
h2,
h3,
h4,
h5,
h6 {
    color: var(--color-heading);
    color: aliceblue;
    font-weight: 700;
}

a {
    text-decoration: none;
    color: var(--color-body);
    transition: all 0.5s ease;
}

a:hover {
    color: var(--color-brand);
}

img {
    width: 100%;
}

h3 {
    color: white;
}


@media (min-width:992px) {
    .navbar {
        min-height: 100vh;
        width: 240px;
        background: linear-gradient(rgba(3, 63, 71, 0.623), rgba(3, 63, 71, 0.853)), url(./sidebar-img.jpg);
        background-size: cover;
        background-position: center;
    }

    .navbar img{
        border: 8px solid var(--color-brand);
    }
}
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Portfolio</title>
    <link rel="stylesheet" href="style.css">
    <link rel="stylesheet" href="   https://cdn.jsdelivr.net/npm/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="2f4d40405b5c5b5d4e5f6f1a011d011c">[email protected]</a>/dist/css/bootstrap.min.css">

</head>

<body>
    <!-- Navigation bar start -->
    <nav class="navbar navbar-expand-lg  navbar-dark fixed-top">
        <div class="container flex-lg-column">
            <a class="navbar-brand mx-lg-auto mb-lg-4" href="#"><span class="h3 text-white fw-bold d-block d-none">Shuvo Raj</span>
                <img src="./person.jpg" class="d-none d-lg-block rounded-circle" alt="">
            </a>
            <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav"
                aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
                <span class="navbar-toggler-icon"></span>
            </button>
            <div class="collapse navbar-collapse" id="navbarNav">
                <ul class="navbar-nav ms-auto  flex-lg-column text-lg-center">
                    <li class="nav-item">
                        <a class="nav-link" href="#home">Home</a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link" href="#services">Services</a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link" href="#work">Work</a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link" href="#about">About</a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link" href="#reviews">Reviews</a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link" href="#blog">Blog</a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link" href="#services">Contact</a>
                    </li>
                </ul>
            </div>
        </div>
    </nav>
    <!-- navigation bar close -->

    <script src="https://cdn.jsdelivr.net/npm/@popperjs/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="9bf8f4e9fedba9b5aaaab5ad">[email protected]</a>/dist/umd/popper.min.js"
        integrity="sha384-oBqDVmMz9ATKxIep9tiCxS/Z9fNfEXiDAYTujMAeBAsjFuCZSmKbSSUnQlmh/jp3"
        crossorigin="anonymous"></script>
    <script src="https://cdn.jsdelivr.net/npm/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="2b4944445f585f594a5b6b1e05190518">[email protected]</a>/dist/js/bootstrap.min.js"
        integrity="sha384-cuYeSxntonz0PPNlHhBs68uyIAVpIIOZZ5JqeqvYYIcEL727kskC66kF92t6Xl2V"
        crossorigin="anonymous"></script>
</body>

</html>

navbar color can't vanish or be transparent because it is linked to body color, how to solve this issue? I'm working on some projects based on YouTube tutorials and encountering an error. Is there a way to overcome these challenges?

I'm developing this project using HTML/CSS/Bootstrap 5.

Encountering This Problem!!

Desired Outcome

Answer №1

There are numerous ways to tackle this issue. For instance, in the CSS for *{…}, you have the option to utilize *:not(.navbar){…

Alternatively, you can simply add !important at the end of the background property like so:

background-color:#33b5e5 !important;

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Having difficulty retrieving the Area and Range information in ChartJS

I am new to working with HTML5 and ChartJS. I have noticed two different types of declarations when attaching JS Chart Versions 1.0.1 and 2.1.1. Can you please provide some insight into this? Additionally, I am facing an issue where the stripes behind the ...

How can you define rules for font fallbacks that are specific to each font?

There are times when web fonts fail to load, especially if hosted on platforms like Google Fonts. In such cases, fallback fonts may require special attention as they can vary significantly from the originally specified fonts. For example: font-family:&ap ...

Looking for assistance with HTML regex (even though I understand it's not the recommended approach)

Before we dive in, let me just say that I'm using this regex to work around a bug while waiting for the server team to address it. The issue is that I'm receiving JSON with unescaped " characters within HTML. I need a regex that can identify the ...

Tips for positioning and styling submenu on dropdown using CSS

I am facing an issue with my navigation menu in the design. The sub menu is not displaying when hovered. Is there a solution to fix this problem? Could it be due to missing CSS styles? nav ul {list-style-type: none; overflow: hidden; background: #000; p ...

Angular silhouette casting on CSS fold

I am attempting to recreate this design as accurately as possible, but I am struggling with replicating the shadow effect on the right side. Is it achievable using CSS? CSS: *{margin:0px;padding:0px;} html { width:100%; height:100%; te ...

An HTML button generated by a .js file is able to execute a .js function without any issues, but it inadvertently removes all .css styling

Currently grappling with an issue in my JavaScript self-teaching journey that I can't seem to resolve or find examples for. The problem at hand: When the HTML button calls a .js function, it successfully executes the function but also wipes out all C ...

RSS eluded HTML

My interpretation of RSS's "escaped HTML" is when code like this appears: HTML: 1 &lt; 3 Is transformed in RSS to: 1 &amp;lt; 3 So, the question arises, should this: <img src="http://somehost/someimage?a=foo&amp;b=bar" /> Be c ...

Tips on showcasing lengthy string content from JSON in a structured list format using react with typescript

Is there a way to display long string data from a JSON file in a list format when the description string is too lengthy? How can I split or format the description using React and TypeScript? The JSON data I have is as follows: "options": [ ...

Alert: The comment index is not defined on line 5 of the comment.php file located in C:xampphtdocsindex

There is a piece of code I am struggling with: <?php if($_POST){ $name = $_POST['name']; $content = $_POST['comment']; $handle = fopen("comments.html","a"); fwrite($handle,"<b>" . $name . "</b><br ...

Combining data using D3's bar grouping feature

I'm currently exploring ways to group 2 bars together with some spacing between them using D3. Is there a method to achieve this within D3? I found inspiration from this example. var data = [4, 8, 15, 16, 23, 42]; var x = d3.scale.linear() .doma ...

What is the best way to bring a local package into another npm package and verify its functionality using Typescript?

In a scenario where there are 3 npm projects utilizing Webpack and Typescript, the folder structure looks like this: ├── project1/ │ ├── tsconfig.json │ ├── package.json │ ├── src/ │ │ └── index.ts │ ...

Insert a new <tr> element into a dynamic table using PHP and jQuery without the need to refresh the page

I am attempting to dynamically insert a row into an existing table when a button is clicked. The rows in the table are created dynamically based on data retrieved from a PHP script. My approach involves making an ajax call to the insert_tr.php script, whi ...

Generate a custom comment page for every URL identifier

I am currently working on creating a PHP comment page that displays unique comments for each specific URL ID. However, I have encountered an issue where the comment page is shared among all URLs. I understand that I need to add the URL ID (bug ID) to the M ...

Invoking functions within a jQuery extension

I've come up with this code to define the instance of my plugin: $.fn.someplugin = function(opts) { $(document).on('click', '.option-1', function() { alert(1); }); }; To make my plugin work, I utilize code similar to this ...

What's preventing my Angular list from appearing?

I am currently developing an Angular project that integrates Web API and entity framework code first. One of the views in my project features a table at the bottom, which is supposed to load data from the database upon view loading. After setting breakpoin ...

Utilize custom scrollbar design exclusively for Windows operating system

My goal is to customize the scrollbar style of a div specifically for Windows systems. While most mobile devices have invisible scrollbars that I want to keep hidden, the aesthetics of Mac OS scrollbars are acceptable to me. What I really need is to make t ...

Ensure the security of multiple forms by validating password fields

I'm encountering some validation issues on my webpage. I have several forms, each designed to update a user's password. The requirement is that if a user inputs something into the password field, they must also enter the same value in the passwor ...

What causes CSS to fail to load in React but work normally in Next.js?

We are currently experiencing an issue with a component located in a Git Submodule that is being used by both Next.js and React. While everything is functioning correctly in Next.js, React is unable to accept the way the CSS is being loaded: import styles ...

Adjust the size of the image to fit within the div container following

<div id="homePage" style="position: relative; margin: 0px; width: 320px; height: 420px;"> <img id="userImg" src="images/5.jpg" width="100%" height="100%" onclick="imageClick()" style=" z-index: -1; margin: 0 ...

Guide to retrieving a file stored locally with VueJS

Currently, I am working on an upload system and I want to provide users with a sample template. The template is stored locally in a subfolder within the assets directory. My goal is to access this template in my VueJS component and display a link to it on ...