Bootstrap 4 Typography

Bootstrap includes styles that define how text elements appear.

This page shows how certain text elements are rendered when using Bootstrap (often without using any classes). Generally, any page that links to the Bootstrap 4 style sheet will render these elements in the same way (unless overridden by other styles).

Body Text

Bootstrap 4's global default font-size is 16px (applied to the <html> element) and the <body> element also has a font-size of 1remapplied.

Bootstrap uses a "native font stack" (user's system fonts), with a fallback to Helvetica Neue, Arial, and sans-serif.

All headings and p elements have their top margin removed. Headings have a bottom margin of .5rem and p elements have a bottom margin of 1rem.

You are completely free to change any of these values to suit your own project.

Headings

Here's a sample of heading elements as they appear in Bootstrap 4:

Heading Classes

Bootstrap also includes heading classes from .h1 to .h6 in case you need to render some inline text in the style of a particular heading.

Sub-Headings

You can create a sub-heading or secondary text by placing text inside a <small> element within the heading.

Display Headings

Display headings are designed to stand out more than the normal headings. There are 4 sizes of display heading (.display-1, .display-2, .display-3, and .display-4).

So for example, a <h1> element could be rendered in 4 different sizes using display heading classes.

To create a display heading, add one of the above classes to the heading element.

Lead Text

You can make a paragraph stand out by using Bootstrap's .lead class.

Marked Text

The HTML <mark> element represents text as marked or highlighted for reference purposes, due to its relevance in another context.

Here's an example of Bootstrap's rendering of this element:

Abbreviations

In HTML, the <abbr> represents an abbreviation or acronym. The title attribute can be used to provide an expansion of the abbreviation.

In Bootstrap, abbreviations with a title attribute are rendered with a light dotted bottom border and a help cursor on hover.

Initialism

You can add the Bootstrap .initialism class to render the abbreviation in a slightly smaller font size.

Blockquotes

To apply Bootstrap's styles to the <blockquote> element, use the .blockquote class.

Blockquotes — Source

Bootstrap renders the <cite> and <footer> elements nested inside the <blockquote> element like this:

Blockquotes — Alignment

You can use the Bootstrap text utilities to specify the alignment of a blockquote. For example, .text-center:

And .align-right:

Lists

Bootstrap applies various styles and has a number of classes specifically for lists.

Lists — Unstyled

You can use the Bootstrap .list-unstyled class to render lists without their default list-style and left-margin:

Lists — Inline

You can use the Bootstrap .list-inline and .list-inline-item classes to render lists as display: inline-block and to apply some padding:

Description Lists

In Bootstrap, description lists are rendered like this:

Description Lists — Horizontal

You can make the terms and descriptions line up horizontally by adding Bootstrap's .row class to the dl tag, then any of the grid system's predefined classes to the dt and dd tags.

Code

In Bootstrap, the <code> element is rendered like this:

Keyboard Input

In Bootstrap, the <kbd> element is rendered like this:

Preformatted Text

In Bootstrap, the <pre> element is rendered like this:

You can also add Bootstrap's .pre-scrollable class to set a max-height to 350 pixels and set a y-axis scrollbar.

Sample Text

In Bootstrap, the <samp> element is rendered like this:

Variables

In Bootstrap, the <var> element is rendered like this: