How can I customize the color of Bootstrap spinners without using text color utilities?

After incorporating a Bootstrap-4 spinner (outlined in this guide) on my webpage, I noticed that only the standard text color utility colors can be applied to it (such as primary, warning, success...), which feels restrictive. I want the flexibility to modify the theme of my webpage, and subsequently the color of the spinner, to a custom color not included in the standard text color utilities. Is there a way to achieve this and if so, how would I go about implementing it?

Answer №1

Here's a suggestion to help you out:

<div class="loading-spinner" role="status" style="color: green">
  <span class="hidden-text">Please wait...</span>
</div>

Answer №2

If you want to customize the color of bootstrap spinner, it's easy to do so. Just adjust the color property in the spinner CSS.

.text-green {
  color: green;
}
.text-purple {
  color: purple;
}
.text-yellow {
  color: yellow;
}
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" rel="stylesheet"/>


<div class="spinner-border text-green" role="status">
  <span class="sr-only">Loading...</span>
</div>

<div class="spinner-border text-purple" role="status">
  <span class="sr-only">Loading...</span>
</div>

<div class="spinner-border text-yellow" role="status">
  <span class="sr-only">Loading...</span>
</div>

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

Modifying Div Size with Jquery

I am working on populating the div container with square boxes, but I'm having trouble adjusting the size of my #gridSquare div. Despite trying to change its height and width using jQuery, it doesn't seem to work as expected. $('#gridSquare ...

What is the best way to apply css styles to buttons in Leaflet?

Trying to customize the CSS for the zoom buttons in Leaflet, but unable to assign a class or id. How can I access them? Any suggestions? Thanks! Map declaration: L.tileLayer('https://api.tiles.mapbox.com/v4/{id}/{z}/{x}/{y}.png?access_token={acces ...

bootstrap 4 grid of responsive cards

I am attempting to replicate the layout of CodePen's dashboard or, if you do not have an account, you can view CodePen's home screen. My goal is to create a dynamic list of cards that are responsive and adjust the number of cards displayed in a ...

search icon not displaying correctly when added to search form on mobile devices using Bootstrap 4

A dropdown is used for the search form, where upon clicking the search icon, the search form appears. It functions correctly and is positioned as expected. However, when the screen size reaches small breakpoints, the search form does not properly append wi ...

Creating a user-friendly responsive design similar to Whatsapp web by utilizing Bootstrap 4 and Ember framework

I am currently in the process of creating a user interface similar to Whatsapp web. My tools include Bootstrap 4 and Ember 3.2. The foundation of my idea is set, with a message box positioned at the bottom of the screen using the fixed-bottom Bootstrap cla ...

How to create a listview with stylish rounded corners in jQuery mobile using CSS?

I'm attempting to customize the appearance of a jQuery mobile listview using CSS by adding a border radius to each item. Although things seem to be working mostly as expected, I've encountered a problem where only the first and last <li>&l ...

I have encountered a formatting issue while using an external CSS file for the main layout of the header and sidebar in Laravel-8 with Bootstrap-5. When I try to @extend certain classes, the content layout becomes distorted

Customizing the Main Layout CSS File for Header and Sidebar: <link href="{{ asset('app.css') }}" rel="stylesheet"> *Note: The external app.css file is located in the public directory. Homepage Content <link rel=&qu ...

Incorporating a YouTube or Vimeo video while maintaining the proper aspect ratio

On my video page, I embed Vimeo videos dynamically with only the video ID. This causes issues with the aspect ratio as black bars appear on the sides due to the lack of width and height settings. The dynamic video ID is implemented like this: <iframe ...

"Struggling to design a hover drop-down menu using HTML and CSS. Need some assistance

Currently, I am attempting to craft a drop-down menu using HTML and CSS with a hover effect. Below is the HTML code that I have been working on: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-tran ...

The animation of a disappearing div with CSS is not stopping when hovering over it

Hello, I've been working on a snackbar feature that appears and disappears on a set timer but also needs to pause when hovered over. Unfortunately, the current setup with setTimeout and useState is causing issues with this functionality. I have looke ...

Guide on generating a scatter plot by utilizing specific x and y coordinates from a subset of data, then color-coding the points according to a

Currently, I am working on visualizing an outcome measure (specifically dendritic spine density) based on x and y sampling coordinates. Each point on the plot is color-coded according to its density value. My goal now is to display specific subsets of my d ...

How can I deactivate Bootstrap specifically within a certain block of content?

Is there a way to deactivate Bootstrap within a specific section? I want the styles from Bootstrap's CSS file to be overridden inside this div. ...

Looking to showcase API images in a three-column layout?

I have a challenge with displaying images fetched from an API in the browser. I intended to show them beautifully in 3 columns, but after implementing react semantic UI's Grid and react-bootstrap's CardColumns, they all appear in just one column. ...

Invoke a function within the <img> tag to specify the source path

I have been attempting to achieve something similar to the following: <img id="icon" class="cercle icon" src="getIcon({{item.status}})" alt=""> This is my function: getIcon(status){ switch (status) { case 'Ongoing': ret ...

What is the best way to arrange text inputs in alignment?

I encountered an issue while creating a form that includes fields for username, password, and email. The alignment of the email input box seems to be off when compared to the username and password input boxes. Is there a method to ensure that all the input ...

What is the best way to align a group of social media icon background images in the center

Looking for assistance with centering a block of social icons on my website when viewed on a mobile browser. Here is the HTML: <div id="header-tel-no">Tel: 123456789</div> <div id="social-buttons-header"> <p><a class="social-bu ...

Listing items in a table using ng-repeat

I'm currently working on constructing a table using ng-repeat, but I also need to incorporate a toolbar. The table design I have in mind is similar to the one shown in the image below, however, I require additional rows to be inserted under the sectio ...

Prevent users from clicking by using a CSS class in HTML and JavaScript

,hey there buddy 1° Can you help me figure out how to prevent click behavior using the CSS class? 2° I'm unable to add an ID to the HTML element, so I need to use the Class to achieve this. 3° None of my attempts have been successful so far. El ...

"Struggling to horizontally center a div with a fixed width in CSS - what am I

Whenever I try to use it on my browser, the content shifts to the left and I can't seem to center it using text-align or flexbox. The issue gets resolved when I remove the width property, but I really need it to have that paragraph-style look I'm ...

What are some alternative ways to utilize jQuery siblings() without restricting it to the same parent element?

In the code provided below as Non-functional code [1], it will function correctly with siblings() to disable other input fields if their sum or amount exceeds a specified maximum value. This works effectively when all input fields are within the same paren ...