Can someone explain to me how I can customize the background of a bootstrap container?

Currently, I am working on an EJS login project and I have created a style.css file with the following code:

[theme="bloodRed"] {
    background-color: #ff2424;
    color: #e571e1;
    accent-color: #00ff00;
}

In my register.ejs file, the HTML structure is as follows:

<!DOCTYPE html>
<html lang="en" theme="bloodRed">
    <head>
        <meta charset="UTF-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <title>Sign up</title>
        <link href="https://cdn.jsdelivr.net/npm/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="482a27273c3b3c3a2938087d667b000cdcdb07041011370c0c040708fff6fe">[email protected]</a>/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-GLhlTQ8iRABdZLl6O3oVMWSktQOp6b7In1Zl3/Jr59b6EGGoI1aFkw7cmDA6j6gD" crossorigin="anonymous">
        <link href="/css/style.css" rel="stylesheet">
        <link rel="icon" href="https://getbootstrap.com/docs/5.3/assets/img/favicons/favicon-32x32.png" sizes="32x32" type="image/png">
    </head>
    <body>
        <div class="container">
            <div class="login-box">
                <div class="row">
                    <div class="col-md-6">
                        <h2>Sign up</h2>
                        <form action="register" method="post">
                            <div class="form-group">
                                <label>First and Last name:</label>
                                <input type="text" name="name" class="form-control" required>
                            </div>
                            <div class="form-group">
                                <label>Email:</label>
                                <input type="email" name="email" class="form-control" required>
                            </div>
                            <div class="form-group">
                                <label>Password:</label>
                                <input type="password" name="password" class="form-control" required>
                            </div>
                            <button type="submit" class="btn btn-outline-info" style="margin-top: 10px;"> Sign up </button>
                        </form>
                        <p style="margin-top: 15px;">Already have an account?   <a class="btn btn-outline-success" href="login">Login here!</a></p>
                    </div>
                </div>
            </div>
        </div>
    </body>
</html>

Furthermore, I have written JavaScript code to connect these files:

const express = require("express");
const app = express();
app.use(express.static("public"));
app.set("view engine", "ejs");

However, when I view the register.ejs file, the text and background do not change within the specified div. The surrounding areas outside the div appear in red. Any suggestions or solutions would be greatly appreciated.

Answer №1

CSS is governed by specificity and cascade rules. The issue arises when you add your own 'theme' property to the html element, but Bootstrap CSS (specifically in the reboot) takes precedence by setting a white background color for the body and text color to #212529.

While adding your theme property to the body tag may help, there are numerous other elements where text or background colors can be applied. It's more effective to utilize Bootstrap SASS modules and/or custom properties (CSS variables). The Customization section of the documentation provides detailed instructions on how to do this.

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

Running a React app from an Express server: A step-by-step guide

Can anyone provide guidance on running the react page index.html from an express server on port 3000? I am still learning about React and could really use some assistance here. Attached is a screenshot of my server.js page for reference: Thank you in adva ...

What is the functionality of the getBlock('meta') method within DocPad?

While transitioning a website from a different site generator to DocPad, I am currently exploring the capabilities of the getBlock('meta') feature. Understanding how to utilize getBlock('scripts') and getBlock('styles') was re ...

Performing synchronized execution in a node.js application by utilizing the 'readline' package

Struggling with the asynchronous nature of node.js, despite hours spent on callbacks and researching. I have a program that reads lines from a file using the readline module in node, passing data to async functions within the program. The goal is to proces ...

Shifting Elements - Navigation triggers subtle movements in CSS styles as you move across pages

I've noticed a strange issue on my website where certain elements seem to be shifting slightly when navigating between different pages. Here's a quick video clip demonstrating the problem. It appears that these elements are not staying static as ...

Why does React-Perfect-Scrollbar not work properly when the height of an element is not specified in pixels?

Currently, I am developing a chat application with React 18 for its user interface. The app includes a sidebar that displays user profiles. To ensure the app fits within the browser window height, I've made the list of user profiles scrollable when n ...

Sequelize Merge Mistakes

I am currently in the process of linking my Images table with my Description table by following a guide that involves creating separate JavaScript files for each model and then connecting them in an index file. In this relationship, an Image can only be as ...

Using Node.js and Typescript to implement a chain of logical AND operations with an array of any length

Setting: I am developing a versatile function that determines a boolean outcome based on logical AND operations. However, the function is designed to handle various types of objects and arrays, each requiring different conditions. Currently, my code look ...

Truncating text with ellipsis in CSS when wrapping on a nested div structure

Here is a 3-tier nested div tree structure with the outer node having a maximum width where I want the ellipsis wrapping to occur. I've almost achieved the desired result, but the issue arises when the inner nodes are not trimmed to accommodate as mu ...

Create a sleek and uniform design with Bootstrap by setting up three columns that maintain the same height

I am attempting to design a 3 column div that maintains equal height for all responsive rows, each containing an ICON and information. <div class="container"> <div class="row row-eq-height"> <div class="col c ...

Encountering a fatal error while running a node.js git hook

I'm encountering a fatal error while running a git hook (pre-push). Below is the code I am using: #!/usr/local/bin node var exec = require('child_process').exec process.exit(1) It's nothing too complex, just experimenting with some ...

Saving the author of a message from one function and transferring it to another

I'm currently working on a Discord bot that manages tickets as applications. I've almost completed it, but I want the bot to log the closed ticket when the -close command is used. I've experimented with different approaches, such as using a ...

Is it possible to divide a column in an HTML table into two separate

I am currently working with an array of elements that I need to iterate over. For each element, I create a <td></td> tag. When dealing with 10 elements, it results in a table with one column and 10 rows. Is there a method, using either HTML o ...

Encountering an 'Access Denied' issue while utilizing Multer-S3 for uploading files to an AWS S3 Bucket

I have encountered an issue while trying to upload a file from my express backend application using Multer-S3. The error message I receive is 'Access Denied'. Here is the detailed error information: { "success": false, ...

Why is the CSS selector `:first-child:not(.ignore)` not working to exclude the `ignore` class from the selection?

Is there a way to utilize the first-child selector with the not(.ignore) selector to target every element that is the first child of its parent, except when that first child has the class ignore? I've experimented with :first-child:not(.ignore){...}, ...

The function element.innerHTML is invalid when trying to assign an object value as an option

Hey there! I'm currently working on a JavaScript project where I have an input that retrieves text from an array. Each option in the array needs to be linked to an object so I can utilize its attributes. const data = [ { name: "SIMPLES NACION ...

Two full screen divs aligned side by side using float:left

Looking for a way to create UL or DIV elements where each list item/child div takes up the full screen space (100% width, 100% height) and is floated left for horizontal scrolling. Here's my code, but it's not working as expected: HTML: <htm ...

What day of the week should Twilio choose for their event?

While using Twilio, I have come up with a straightforward solution to play an audio file when receiving a call. However, I now want to customize it so that different Mp3 files are played depending on the day of the week. For example, playing the first Mp3 ...

Utilizing Node modules in TypeScript, Angular 2, and SystemJS: A Comprehensive Guide

In the process of developing a simple Angular 2 application, I am constructing a class named User. This class includes a function called validPassword() which utilizes the bcrypt library to validate user passwords: import { compareSync, genSaltSync, hashS ...

Encountering an error while attempting to run npm install

When attempting to run the npm install command, an error is displayed: [log@server:www]$ npm install npm ERR! code ERESOLVE npm ERR! ERESOLVE unable to resolve dependency tree npm ERR! npm ERR! While resolving: undefined@undefined npm ERR! Found: <a hre ...

Executing Grunt: Setting up a dual Connect and Express server to operate on one port

I'm still fairly new to Grunt and I've been wondering if it's possible to run both servers on the same port simultaneously. I seem to be encountering some issues with this setup, most likely stemming from the Grunt file. I am utilizing grun ...