Issue with Bootstrap CSS: Default color change not functioning properly on Mobile devices, although it works correctly on Desktop

This is my first website project, you can check it out at www.craigdoesdata.de to see the issue I'm facing with CSS. I apologize if this question seems obvious or if it has already been addressed (I have spent a considerable amount of time searching for a solution but couldn't find one).

I am using Bootstrap and have made changes to the background-color for .bg-dark in my custom.css file as follows:

.bg-dark {
    background-color: #21618c !important;
}

On desktop, this change works perfectly. The Navbar and footer reflect the updated color. However, on mobile devices, the default bg-dark color (#343a40) continues to appear. When inspecting the elements, they are referring to _background-variant.scss, which still specifies the old background color:

.bg-dark {
    background-color: #343a40 !important;
}

I have ensured that my custom.css loads last in the header of the HTML, assuming it would take precedence, and it does work on desktop. But there seems to be something missing that prevents the mobile version from utilizing my custom.css stylesheet.

Below is the HTML code snippet:

And here is the content of custom.css:

Thank you in advance for your assistance!

Answer №1

The styling is contained within a media query. For example, observe the code snippet I found while inspecting your website. A media query has been implemented here.

@media (min-width: 992px)
.btn-secondary {
    color: #fff;
    background-color: #21618c;
    border-color: #21618c;
}

As a result, when the device width is less than 992px, the default color values are being applied instead of the customized values specified in your custom.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

Surprising margin discrepancy of 10px found while utilizing float property in CSS

Encountered an issue with the CSS property "float". There is a 10px margin at the top of the page. How can this be fixed? I tried adding an empty div to the parent div with id="background1", but it did not work. I also found this article https://css-trick ...

Issues with menu navigation drop-downs

I'm beginning my journey into web development and currently working on creating a navbar for my website. I found a script in bootstrap that I'm trying to implement. I need help figuring out what href to include in the second line. I have a clear ...

JavaScript toggle display function not functioning properly when clicked

I've been attempting to create a drop-down list using HTML and JavaScript, but for some inexplicable reason, it's just not functioning as expected despite scouring through countless tutorials on YouTube. Below is the snippet of code that I'm ...

unable to alter color using CSS

So I've heard that the CSS code is good. Here is the HTML code I am using: <DOCTYPE! html> <html lang="nl"> <head> <title>The White Stripes!</title> <link rel="stylesheet" type="text/css" href="home.css"& ...

Discover the best practices for incorporating max-width into a bootstrap d-flex container with rounded corners

I have been working on a login page design using bootstrap, but I am facing an issue with the width of a div element that I want to use for placing a logo. The w-100 class doesn't seem to be making it full width as intended. To see the problem and my ...

Unsure why the React button is disappearing specifically on Safari iOS. Any thoughts on how CSS

Hey there! I created a small hamburger button for my website, but for some reason, it doesn't show up on Safari iOS. Interestingly, it works perfectly fine on Windows Chrome, Windows Firefox, and my Android device. I've been trying to troubleshoo ...

Activate animation when a user clicks on a link

Hey there, I'm a bit unsure about how to word this and I'm still getting the hang of StackExchange so I hope I've posted in the correct place. Currently, I am developing a mobile HTML5 app that utilizes Phonegap/Cordova (as well as Bootstra ...

When using Nav, it is necessary to only have one dropdown open at a time by closing others before opening a new

I am encountering an issue with my dropdown menu system. I have multiple submenus within a top-level dropdown menu, and the problem is that when I open one submenu and then click to open another, the first one remains open. I would like for the other subme ...

I am currently working on an Angular 8 project and experiencing difficulties with displaying a specific value from a JSON object in my template using an ngFor loop

Apologies if I am not familiar with all the terms, as I am mostly self-taught. I started with Udemy and then turned to Stack Overflow to tackle the more challenging aspects. This platform has been incredibly valuable and I am truly grateful for it. Now, l ...

Transferring data from a FreeMarker template page to a servlet controller

I am new to servlets and FreeMarker (.ftl) templates, so there may be some guesswork involved. I need to send a value from a webpage to my servlet. Here's what I have tried: FTL code: <form action="someAcction.spring" method="post"> <i ...

What is the best way to retrieve the content of HTML tags from a string using JavaScript or AngularJS?

I have a string with mixed content of HTML tags and text. Here is an example: var str = "<p></p><p><i>blabla</i></p><p><i><b>blaaaaaablaaaaa</b></i></p><iframe src="..." height=" ...

Creating an unconventional design utilizing ul and li elements with varied heights

Can I create the layout below using ul/li elements without any unusual tricks? All the elements in red should have the same width. Why do I want to use ul/li elements? Throughout the page, there are ul/li elements with a very similar layout, where all i ...

Enlarge the image to fill the entire screen

Currently, I am working on a webpage where I am displaying data fetched from a database using Laravel framework. The code snippet is shown below: Here is how the webpage looks like - image1 What I aim to achieve is to make the div go fullscreen upon clic ...

I have configured my CSS styles in the module.css file of my Next.js application, but unfortunately, they are not being applied

I recently developed a nextjs with electron template application: Here is the link to my code on CodeSandbox: https://codesandbox.io/s/sx6qfm In my code, I have defined CSS classes in VscodeLayout.module.css: .container { width: '100%'; he ...

What is the best semantic HTML element to use for organizing comments: <ol>, <ul>, <article>, or <blockquote>?

I conducted some thorough research but couldn't find a satisfactory answer. I'm pondering whether it would be more beneficial to continue using li elements or transition to the article element for displaying comments. For Example 1: <ol clas ...

How to sanitize data by removing HTML tags in a MySQL query before inserting or selecting from a database table

My dilemma involves data that is wrapped in HTML tags. I need to transfer this data into a database table as simple text, without the accompanying HTML formatting. Is there MySQL code available that could assist in stripping out the HTML tags during eithe ...

Ways to modify the text of an HTML element when hovering over it

One of my elements contains the text &times; within a <span>. Is there a way to change this symbol to something else, like &infin;, when hovered over? <span class="change-text">&times;</span> When the mouse hovers over it, I ...

Using a <button> tag instead of a <div> inside of a <button> is not allowed, as clickable divs are typically frowned upon. What

I'm currently developing a React App that functions as a calendar, allowing users to click on specific days displayed as large squares to view information for that day. For accessibility purposes, I initially considered using <button> elements b ...

Guide on forwarding from one HTML page to another in the local disk

Currently, I am working on an employee appraisal application where users can submit appraisals that are stored in the backend. The initial page is a login screen. Once the user successfully logs in, they should be redirected to another page displaying in ...

What could be causing the lack of changes when trying to use justify content within the parent div?

I've been delving into CSS and trying to utilize justify-content in flex to center my content, but unfortunately, it's not cooperating. Here is the code I'm working with: .top-container{ display: flex; flex-flow: row nowrap; ma ...