Customizing the font color and size of the brand text in the Bootstrap 5.1.3 Navigation Bar is not allowed

I am currently working on a main page that includes a bootstrap navigation bar with a dropdown menu. I have successfully managed to display the dropdown menu and change its color using CSS. However, I encountered an issue when attempting to modify the font size and color of the title text within "navbar-brand". Despite trying various sizes in my CSS file, the font size and color remained unchanged. Can someone assist me with this? Below are the snippets of code:

body {
  font-family: 'Domine', sans-serif;
  text-align: center;
}

h1, h2, h3, h4, h5, h6 {
  font-family: 'Domine-Bold', sans-serif;
}

.navbar-nav > li > .dropdown-menu {
  background-color:#F9FFA4;
}


.navbar-brand {
  
  color: red;
  font-family: 'Domine-Bold', serif;
  font-size: 150px; 
  font-weight: 700;  
}

.navbar-default .navbar-nav > .open > a,
.navbar-default .navbar-nav > .open > a:focus,
.navbar-default .navbar-nav > .open > a:hover {
  background-color:#F9FFA4;
  
}
    <!DOCTYPE html>
<html lang="en" dir="ltr">
  <head>
    <meta charset="utf-8">
    <title>Sample</title>

    <meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover">
    <meta name="format-detection" content="telephone=no">   

    <!-- CSS Stylesheet -->
    <link rel="stylesheet" href="css/styles.css">

    <!-- <title>Sample</title> -->   

    <!-- Bootstrap 5.1.3 -->
    <link href="https://cdn.jsdelivr.net/npm/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="2f4d40405b5c5b5d4e5f6f1a011e011c">[email protected]</a>/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">

    <!-- Popper -->
    <script src="https://unpkg.com/@popperjs/core@2"></script>

    <!-- Google Fonts -->
    <link rel="preconnect" href="https://fonts.googleapis.com">
    <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
    <link href="https://fonts.googleapis.com/css2?family=Domine:wght@700&display=swap" rel="stylesheet">

    <!-- Bootstrap Script -->
    <script src="https://cdn.jsdelivr.net/npm/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="ef8d80809b9c9b9d8e9fafdac1dec1dc">[email protected]</a>/dist/js/bootstrap.bundle.min.js" integrity="sha384-ka7Sk0Gln4gmtz2MlQnikT1wXgYsOg+OMhuP+IlRH9sENBO0LRn5q+8nbTov4+1p" crossorigin="anonymous"></script>
    
  </head>
  <body>
    <section class="color-section" id="title">
      <!-- Nav Bar -->
        <nav  class="navbar navbar-expand-lg navbar-light" style="background-color:#F9FFA4">

        <div class="container-fluid">
          <a class="navbar-brand" href="#">HomeTitle</a>
          <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarHome" aria-controls="navbarHome" aria-expanded="false" aria-label="Toggle navigation">
            <span class="navbar-toggler-icon"></span>
          </button>

          <div class="collapse navbar-collapse" id="navbarHome">
            <ul class="navbar-nav ms-auto mb-2 mb-lg-0">
              ...
              
                <a class="nav-link dropdown-toggle" href="#" id="navbarDropdownNewIn" role="button" data-bs-toggle="dropdown" aria-expanded="false">
                  New In
                </a>
                <ul class="dropdown-menu" aria-labelledby="navbarDropdownNewIn">
                  <li><a class="dropdown-item" href="#">Solar Phone Charger</a></li>
                  ...

    </section>

  </body>
</html>

I was aiming to increase the font size and change the font color for the "HomeTitle" in navbar-brand, unfortunately without success.

Answer №1

The reason for this issue is that your bootstrap file is positioned below the main styles.css where you apply your custom styles, resulting in the overrides not being reflected. This occurs because the framework-related bootstrap file takes precedence over your styles. To resolve this issue, ensure that your primary CSS file is included after the bootstrap.min.css file.

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

Concealing an Automatically Updated Section when Devoid of Content -- Ruby on Rails Version 4

I have come across various solutions to this problem, but none of them seem to be effective for my specific project. In my application, the user's previous choices are displayed in multiple divs. Initially, all the divs are empty. As the user progress ...

Using jquery to submit a form with multiple fields spread across various tabs

Utilizing a bootstrap modal, I aim to display detailed information about a single product. Within this modal, there are three tabs categorized as details, image, and specification for the respective content components of the product. Upon clicking the edi ...

Locate specific elements on a webpage without scanning through the entire content

Is there a way to optimize the performance of getElementsByTagName("td") so it doesn't search the entire document? I'm experiencing long wait times for results. Here is an excerpt from my code: $ie.Document.getElementsByTagName("td") | ? {($_.c ...

Just getting started with JavaScript and running into trouble creating an array of image objects using an array of strings

I am struggling to accurately describe my issue, making it difficult to find a solution. I have an array called tempData generated from a text file that I want to reference with variables of the same name as the strings in the array. var red = new Image ...

Develop a unique Kotlin/JS WebComponent featuring custom content

I am trying to create a custom tag using Kotlin that includes default content. While the example I found works well, I am having trouble adding default content (such as an input element) inside the custom tag. After attempting various approaches, I have o ...

Hiding elements with CSS using the display:none property and using the :

Trying to display an image when hovering over another image. Works well in Safari, but Chrome and Firefox fail to load the image properly. Have searched for solutions related to visibility:hidden but none seem to solve this cross-browser issue. HTML being ...

Changing the appearance of a website by switching CSS stylesheets according to the size of the browser

Trying to build two versions of my website: one for mobile devices or small browsing windows, and another for large browser windows. Looking to link HTML to different style sheets based on browser size. Current attempt in code only addresses total screen ...

What is the best way to align the navbar-brand to the right using Bootstrap 4?

I am working with Bootstrap 4 and I have a specific requirement for the navbar-brand item to be positioned on the far right side. By default, the menu appears on the left side. I have attempted to use classes like ml-auto, mx-auto, mr-auto, pull-right, bu ...

Difficulty encountered when positioning a container using BootStrap 4

As a newcomer to the world of web development, I encountered an issue while trying to align a container on my webpage. Despite my efforts to center the container using (line 30), the page seems to update but there is no visible change. Can anyone help me ...

CSS code influencing unintended elements

www.geo-village.com <- Live Example After setting up my main webpage with CSS and PHP files, I noticed an issue with the navigation bar. Despite having a separate PHP and CSS file for the navigation bar items, the Login and Register buttons on the main ...

The new version 5.1 of Bootstrap modal does not disable scrolling on the <body> element

I'm currently working on a project in Angular 11 using Bootstrap (v5.1.3). My main goal is to create a functionality where clicking on a card, similar to a blog post, will trigger a Bootstrap modal popup displaying the content of that specific post. B ...

The Bootstrap modal is not properly clearing all attribute properties when it is hidden

Alrighty, so I've got this modal set up: <div id="modal-container" class="modal fade" tabindex="-1" role="dialog"> <div class="modal-dialog" role="document"> <div class="modal-content center-block" style="displ ...

Tips for centering the InputLabel in Material UI?

Upon loading the page, I am looking to have the InputLabel appear as shown in the second picture. However, I haven't been able to find any InputLabel props that achieve this. I attempted using the focused prop, but it didn't give me the desired o ...

What is the best way to create a button that will trigger a modal window to display a message?

I am looking to create a button that will open a modal window displaying a message. However, when I tried to add a label and viewed the page, the desired window appeared on top of the rest of the content. But unfortunately, clicking the button did not prod ...

Creating a stripped box shadow with just HTML and CSS - a simple guide

Hey there! I'm trying to create a navbar button with a cool stripped box shadow effect when hovered, similar to what you see in this image link. I attempted to achieve this using CSS box-shadow and linear gradient, but unfortunately it didn't qui ...

Hovering over one element in Jquery triggers actions on multiple elements simultaneously

I'm working on a project where I have multiple cards, and I've implemented a hover effect using jQuery to make the images inside the cards bigger. However, I'm facing an issue where hovering over one card triggers the effect on all the other ...

When an image is loaded, use Jquery to automatically open a new tab, instead of

I need to implement a function where, on loading an image on a page, a new tab opens and starts downloading a file from a specific URL while keeping the original page open. This task is part of a WordPress site with a jQuery section in the backend. I' ...

What is the process by which photoswipe applies styles to blur an image upon clicking the share button?

If you want to see an example, check out this link: http://codepen.io/dimsemenov/pen/gbadPv By clicking on the Share button, you'll notice that it blurs the image (and everything else). Despite inspecting it closely, I still can't seem to figu ...

How to enhance your jQuery Gallery with clickable images?

I have recently integrated a jQuery Gallery into my website. While everything is functioning properly, I am looking to transform the gallery images into clickable links that lead to higher quality versions of the images. Below is the code snippet for the g ...

Iterate through each line of code and modify the integer in order to target elements by their class

Originally shared on the MrExcel forum www.mrexcel.com/board/threads/change-integer-in-code-line-for-htmldoc-getelementsbyclassname.1146814/ The initial line of code I used was Set DogRows1 = HTMLDoc.getElementsByClassName("rpb-greyhound rpb-greyhou ...