Bootstrap ยท Chapter 6 of 43

Bootstrap Typography

Bootstrap sets sensible default typography for headings, paragraphs and text, and provides utility classes to fine-tune font size, weight, alignment and style without writing custom CSS.

Headings h1 through h6 come pre-styled, and classes like .display-1 through .display-6 create even larger, more prominent headings often used for hero sections.

Syntax
<h1 class="display-4">Big Heading</h1>
<p class="text-muted">Muted text</p>

Headings and display classes

Standard headings (h1-h6) are automatically styled. Display classes like .display-1 create oversized, lighter-weight headlines for landing pages.

Text utilities

Classes such as .text-center, .text-muted, .fw-bold, .fst-italic and .text-uppercase let you adjust alignment, weight, style and casing directly in your HTML.

Example 1 (html)
<h1 class="display-4 fw-bold">Welcome</h1>
<p class="lead">A short introduction using the lead class.</p>
Output
A large bold heading followed by a slightly bigger intro paragraph

display-4 makes the heading large, and lead increases the paragraph's font size for emphasis.

Example 2 (html)
<p class="text-center text-uppercase text-muted">centered muted text</p>
Output
CENTERED MUTED TEXT (centered, gray, uppercase)

Multiple text utility classes can be combined on one element.

Key points

  • h1-h6 headings are styled automatically by Bootstrap.
  • Display classes create larger, eye-catching headings.
  • .lead makes a paragraph stand out.
  • Text utilities control alignment, weight, style and case.
๐Ÿ’ก Note: Combining multiple utility classes on one element is a normal and encouraged Bootstrap practice.

๐Ÿ“ Quick Quiz

1. Which class creates a large, prominent heading?

2. Which class makes a paragraph stand out as an intro?

3. Which class centers text?