Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Available text color classes in Bootstrap

I'm developing a sign up page, by putting some text as the title at the navigation bar. I want to give those texts different colors. For this purpose I'm using a separate CSS file, but I want to do this using bootstrap's CSS file.

Can anybody list the available color classes in bootstrap?

like image 269
fidel castro Avatar asked Oct 20 '22 16:10

fidel castro


People also ask

What is text color in Bootstrap 4?

Text Colors. Bootstrap 4 has some contextual classes that can be used to provide "meaning through colors". The classes for text colors are: .text-muted, .text-primary, .text-success, .text-info, .text-warning, .text-danger, .text-secondary, .text-white, .text-dark, .text-body (default body color/often black) and .text-light: This text is muted.

How to set background color in Bootstrap?

Until now, you can see the pattern of coloring in Bootstrap. We have seen, the text can be colored by using contextual names by using text-[context class]. Similarly, replace the “text” by “bg” for setting the background colors. The buttons can also be colored in the same way in Bootstrap.

What are the contextual classes in Bootstrap 4?

Bootstrap 4 has some contextual classes that can be used to provide "meaning through colors". The classes for text colors are: .text-muted, .text-primary, .text-success, .text-info, .text-warning, .text-danger, .text-secondary, .text-white, .text-dark, .text-body (default body color/often black) and .text-light: This text is muted.

What are the classes in Bootstrap?

The Bootstrap has specific classes for coloring the text, links, buttons etc. Generally, the class names use the context that may reflect the purpose of the text or some other element.


2 Answers

The bootstrap 3 documentation lists this under helper classes: Muted, Primary, Success, Info, Warning, Danger.

The bootstrap 4 documentation lists this under utilities -> color, and has more options: primary, secondary, success, danger, warning, info, light, dark, muted, white.

To access them one uses the class text-[class-name]

So, if I want the primary text color for example I would do something like this:

<p class="text-primary">This text is the primary color.</p>

This is not a huge number of choices, but it's some.

like image 202
Ted Delezene Avatar answered Oct 23 '22 05:10

Ted Delezene


The text at the navigation bar is normally colored by using one of the two following css classes in the bootstrap.css file.

Firstly, in case of using a default navigation bar (the gray one), the .navbar-default class will be used and the text is colored as dark gray.

.navbar-default .navbar-text {
  color: #777;
}

The other is in case of using an inverse navigation bar (the black one), the text is colored as gray60.

.navbar-inverse .navbar-text {
  color: #999;
}

So, you can change its color as you wish. However, I would recommend you to use a separate css file to change it.

NOTE: you could also use the customizer provided by Twitter Bootstrap, in the Navbar section.

like image 7
lvarayut Avatar answered Oct 23 '22 06:10

lvarayut