Bootstrap 4 Text/Typography


Bootstrap 4 Default Settings

Bootstrap 4 uses a default font-size of 16px, and its line-height is 1.5.

The default font-family is "Helvetica Neue", Helvetica, Arial, sans-serif.

In addition, all <p> elements have margin-top: 0 and margin-bottom: 1rem (16px by default).


<h1> - <h6>

Bootstrap 4 styles HTML headings (<h1> to <h6>)  with a bolder font-weight and an increased font-size:

Example

h1 Bootstrap heading (2.5rem = 40px)

h2 Bootstrap heading (2rem = 32px)

h3 Bootstrap heading (1.75rem = 28px)

h4 Bootstrap heading (1.5rem = 24px)

h5 Bootstrap heading (1.25rem = 20px)
h6 Bootstrap heading (1rem = 16px)
Try it Yourself »

Display Headings

Display headings are used to stand out more than normal headings (larger font-size and lighter font-weight), and there are four classes to choose from: .display-1, .display-2, .display-3, .display-4

Example

Display 1

Display 2

Display 3

Display 4

Try it Yourself »

<small>

In Bootstrap 4 the HTML <small> element is used to create a lighter, secondary text in any heading:

Example

h1 heading secondary text

h2 heading secondary text

h3 heading secondary text

h4 heading secondary text

h5 heading secondary text
h6 heading secondary text
Try it Yourself »


<mark>

Bootstrap 4 will style the HTML <mark> element with a yellow background color and some padding:

Example

Use the mark element to highlight text.

Try it Yourself »

<abbr>

Bootstrap 4 will style the HTML <abbr> element with a dotted border bottom:

Example

The WHO was founded in 1948.

Try it Yourself »

<blockquote>

Add the .blockquote class to a <blockquote> when quoting blocks of content from another source:

Example

For 50 years, WWF has been protecting the future of nature. The world's leading conservation organization, WWF works in 100 countries and is supported by 1.2 million members in the United States and close to 5 million globally.


From WWF's website
Try it Yourself »

<dl>

Bootstrap 4 will style the HTML <dl> element in the following way:

Example

Coffee
- black hot drink
Milk
- white cold drink
Try it Yourself »

<code>

Bootstrap 4 will style the HTML <code> element in the following way:

Example

The following HTML elements: span, section, and div defines a section in a document.

Try it Yourself »

<kbd>

Bootstrap 4 will style the HTML <kbd> element in the following way:

Example

Use ctrl + p to open the Print dialog box.

Try it Yourself »

<pre>

Bootstrap 4 will style the HTML <pre> element in the following way:

Example

Text in a pre element
is displayed in a fixed-width
font, and it preserves
both      spaces and
line breaks.
Try it Yourself »

More Typography Classes

The Bootstrap 4 classes below can be added to style HTML elements further:

Class Description Example
.font-weight-bold Bold text Try it
.font-weight-bolder Bolder text Try it
.font-italic Italic text Try it
.font-weight-light Light weight text Try it
.font-weight-lighter Lighter weight text Try it
.font-weight-normal Normal text Try it
.lead Makes a paragraph stand out Try it
.small Indicates smaller text (set to 80% of the size of the parent) Try it
.text-left Indicates left-aligned text Try it
.text-*-left Indicates left-aligned text on small, medium, large or xlarge screens Try it
.text-break Prevents long text from breaking layout Try it
.text-center Indicates center-aligned text Try it
.text-*-center Indicates center-aligned text on small, medium, large or xlarge screens Try it
.text-decoration-none Removes the underline from a link Try it
.text-right Indicates right-aligned text Try it
.text-*-right Indicates right-aligned text on small, medium, large or xlarge screens Try it
.text-justify Indicates justified text Try it
.text-monospace Monospaced text Try it
.text-nowrap Indicates no wrap text Try it
.text-lowercase Indicates lowercased text Try it
.text-reset Resets the color of a text or a link (inherits the color from its parent) Try it
.text-uppercase Indicates uppercased text Try it
.text-capitalize Indicates capitalized text Try it
.initialism Displays the text inside an <abbr> element in a slightly smaller font size Try it
.list-unstyled Removes the default list-style and left margin on list items (works on both <ul> and <ol>). This class only applies to immediate children list items (to remove the default list-style from any nested lists, apply this class to any nested lists as well) Try it
.list-inline Places all list items on a single line (used together with .list-inline-item on each <li> elements) Try it
.pre-scrollable Makes a <pre> element scrollable Try it

Complete Bootstrap 4 CSS Reference

For a complete reference of all CSS classes available in Bootstrap 4, visit our Bootstrap 4 All Classes Reference.


Copyright 1999-2023 by Refsnes Data. All Rights Reserved.