Loading lessons...
Text Colors
Text Colors
Bootstrap 5 has contextual color classes that change the color of text. They follow a semantic meaning: success is green, danger is red, and so on.
The text color classes
| Class | Meaning | Color |
|---|---|---|
.text-muted | Muted, subtle text | gray |
.text-primary | Main brand color | blue |
.text-success | Success message | green |
.text-info | Informational message | light blue |
.text-warning | Warning message | orange/yellow |
.text-danger | Danger message | red |
.text-secondary | Secondary color | gray |
.text-dark | Dark text | dark |
.text-light | Light text | light |
.text-white | White text | white |
Example
<p class="text-muted">This text is muted.</p>
<p class="text-primary">This text is blue.</p>
<p class="text-success">This text is green.</p>
<p class="text-danger">This text is red.</p>
Text opacity
Bootstrap 5 also supports opacity utilities:
.text-black-50makes black text 50% opaque.text-white-50makes white text 50% opaque
TL;DR
- Use
.text-{color}to color text. - Colors carry meaning: success, warning, danger, info.
.text-mutedcreates subtle gray text.- Opacity helpers like
.text-black-50exist.