Trusted answers to developer questions
Trusted Answers to Developer Questions

Related Tags

bootstrap
selectors
communitycreator

How to color the background and text Bootstrap

Chinweuba Elijah Azubuike

Overview

Bootstrap is a popular framework that can help build responsive mobile-first sites using Bootstrap CDN and the templar starter page. Bootstrap has its own way of adding color styling to HTML groups or elements. This makes it look good without adding internal or external CSS. We look at various colors in this shot and apply them to our HTML code.

Custom colors in Bootstrap

Bootstrap has a total of nine custom colors:

  1. primary
  2. secondary
  3. muted
  4. white
  5. warning
  6. danger
  7. info
  8. light
  9. dark

Applying the colors

We can apply these colors to text, backgrounds, and HTML elements. We will see how to color our background and text in this shot. To change the color of a text, we add the class text-colorname:

Example

Bootstrap Colors

Code explanation

Line 14: Notice how we add text-secondary which gives the text an ash color and the bg-success class that gives the background a green color. To add the text color, we add text-secondary directly to the <p> holding the text.

RELATED TAGS

bootstrap
selectors
communitycreator

CONTRIBUTOR

Chinweuba Elijah Azubuike
RELATED COURSES

View all Courses

Keep Exploring