Advertisement
Google Ad Slot: content-top
Bootstrap 5 Text/Typography
Bootstrap 5 provides a range of typography utilities to help style and format text elements consistently.Here’s a quick overview:
Headings
Bootstrap provides classes for all HTML heading elements (<h1> to <h6>) for easy typography customization. You can use these directly or apply classes to any element to make it look like a heading.
Lead Text:
Use the .lead class for highlighting introductory text or making paragraphs stand out.
Text Alignment:
Bootstrap provides classes to align text easily:
.text-start,.text-center, and.text-end- For responsive alignment, use
.text-sm-start,.text-md-center,.text-lg-end, etc.
This text is centered.
This text is right-aligned.
This text is responsive text-aligned.
Text Color
- You can apply text color with these classes:
.text-primary,.text-secondary,.text-success,.text-danger,.text-warning,.text-info,.text-light,.text-dark,.text-muted,.text-white
Primary text
Success text
Secondary text
Danger text
Warning text
Info text
Light text
Dark text
Muted text
White text
Font Size:
.fs-1 to .fs-6 can adjust font sizes responsively.
|
Class |
Font Size (Default) |
Description |
|---|---|---|
|
fs-1 |
|
Largest font size. |
|
fs-2 |
|
Second largest font size. |
|
fs-3 |
|
Medium-large font size. |
|
fs-4 |
|
Medium font size. |
|
fs-5 |
|
Smaller medium font size. |
|
fs-6 |
|
Default font size. |
Font Weight and Italics:
.fw-bold,.fw-bolder,.fw-normal.fw-light,.fw-lighter, for font weight..fst-italic,.fst-normalfor italics.
This is bold text
This is bolder text
This is normal weight text
This is light text
This is lighter text
Bootstrap font weight and italic
This text is italicized
This text is normal, not italicized
Bold and italicized text
Light weight and not italicized
Line Height:
These line height class make it easy to adjust the spacing between lines of text without writing custom CSS.
lh-1: Sets line height to1lh-sm: Small line height, typically around1.25lh-base: Default line height, usually1.5lh-lg: Large line height, typically around2
This text has a line height of 1.
This text has a small line height.
This text has the default line height.
This text has a large line height.
Text Wrapping and Overflow:
text-wrap: Allows text to wrap within the container.text-nowrap: Prevents text from wrapping.text-truncate: Truncates text with an ellipsis if it exceeds container width.- Overflow: Control overflow with
overflow-auto,overflow-hidden,overflow-visible,overflow-scroll.
This text will not wrap and stay on a single line.
Text Transformation:
text-uppercase: Uppercase text.text-lowercase: Lowercase text.text-capitalize: Capitalizes each word
This text will be uppercase.
This text will be lowercase.
this text will be capitalized.