Concept of Typography in Bootstrap 4

Typography is another concept within Bootstrap that helps in giving styles and formats to text contents. By default, Bootstrap 4 uses 1rem(16px) as font size as well as the line-height remains 1.5. It keeps its default font-family as "Helvetica Neue" where Helvetica, sans-serif, Arial are used. Furthermore, all <p> (paragraph) elements have margin-top set to 0 and margin-bottom set to 1rem(16px).

Default Font Sizes in Bootstrap 4

In Bootstrap 4, the size of the typography font is based on a rem unit of measurement which is relative to the root HTML element. The following table describes the font size in pixels compared to the rem.

HTML Tag / CSS ClassFont Size in remFont Size in Pixel
h1, .h12.5rem40px
h2, .h22rem32px
h3, .h31.75rem28px
h4, .h41.5rem24px
h5, .h51.25rem20px
h6, .h61rem16px
.display-16rem90px
.display-25.5rem82.5px
.display-34.5rem67.5px
.display-43.5rem52.5px
p1rem16px

In the "rem" unit, if you are changing its size to Root, it will affect the size of all the elements of the defined page using the "rem" unit.

Where Bootstrap's Typography Can Be Applied?

Typography can be applied for creating customized:

  • Headings and Subheadings within your web content.
  • Text as well as Paragraph's font color, font face, and its alignment.
  • Ordered and Unordered listings.
  • Any other display texts.

Headings in Bootstrap 4

There are default heading tags in HTML and Bootstrap implements styles on it. Heading is more bold and increased font size in bootstrap 4 than the default HTML headings.

Example:
<h1> Heading 1 </h1>
<h2> Heading 2 </h2>
<h3> Heading 3 </h3>
<h4> Heading 4 </h4>
<h5> Heading 5 </h5>
<h6> Heading 6 </h6>

.h1 through .h6 classes are also available, for when you want to match the font style of a title, but can not use the corresponding HTML element.

Example:
<h1 class="h2"> Heading 1 in the size of Heading 2 </h1>
<p class="h3"> Some Heading texts </p>

Subheadings in Bootstrap 4

The concept of inline subheading will add an additional heading which will act as a subheading for the main <hN> heading (where 'N' is any number between 1 to 6). For this, you have to add the <small> tag as a nested tag within the head element to get the formatting of subheading which you can see in the example below:

Example:
<h1> Heading 1 <small>SubHeading 1</small> </h1>
<h2> Heading 2 <small>SubHeading 2</small> </h2>
<h3> Heading 3 <small>SubHeading 3</small> </h3>
<h4> Heading 4 <small>SubHeading 4</small> </h4>
<h5> Heading 5 <small>SubHeading 5</small> </h5>
<h6> Heading 6 <small>SubHeading 6</small> </h6>

Display headings in Bootstrap 4

Display headings are different from traditional headings elements; you can use it when you need to display a significant, slightly more opinionated title.

There are four types of display heading classes available in Bootstrap 4.

Example:
<h1 class="display-1">Display Heading 1</h1>
<h1 class="display-2">Display Heading 2</h1>
<h1 class="display-3">Display Heading 3</h1>
<h1 class="display-4">Display Heading 4</h1>

Lead in Bootstrap 4

Lead is used to add some emphasis to any paragraph content. It can be implemented something like this:

Example:
<p> This is normal Text without any lead class not emphasized. </p>
<p class="lead"> Example of Lead class with paragraph showing its use to emphasize text. </p>

Text Colors in Bootstrap 4

There are some reference classes available in Bootstrap 4 that are used to display texts in different colors.

Class NameDescription
.text-primaryThis class is used to display texts in blue color.
.text-secondaryThis class can be used for various purposes.
.text-successThis class can be used for various purposes.
.text-dangerRed is mostly avoided in most designs because it shows danger or anger. But you can use it according to your design needs.
.text-warningThis class can be used for various purposes.
.text-infoThis class is used to display texts in blue color which is different from .text_primary.
.text-lightThis class displays text in light colors that are not white.
.text-darkThis class can be used for various purposes.
.text-mutedThe information is silent and is used to represent obsolete data.
.text-whiteThis class displays text in white.

Some Other Typography Classes in Bootstrap 4

Here is a list of some other typography classes in Bootstrap 4, which can be used in styling HTML elements.

Class NameDescription
.font-weight-boldFor creating bold text.
.font-weight-bolderFor creating bolder text.
.font-italicFor creating italic text.
.font-weight-lightFor creating lightweight text.
.font-weight-lighterFor creating lighter weight text.
.font-weight-normalFor creating normal text.
.smallFor creating smaller text which is comparatively 85% smaller than the size of the parent.
.text-breakThis class helps in preventing long text from breaking design and layout.
.text-decoration-noneFor removing the underline from any hyperlink.
.text-justifyFor creating justified text.
.text-monospaceFor creating mono-spaced text.
.text-nowrapFor creating no wrap text.
.text-lowercaseFor creating lowercased text.
.text-resetFor resetting the text color or a link.
.text-uppercaseFor creating uppercased text.
.text-capitalizeFor creating capitalized text.

Scroll Back to Top