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
<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:
<abbr>
Bootstrap 4 will style the HTML <abbr>
element
with a dotted border bottom:
<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.
<dl>
Bootstrap 4 will style the HTML <dl>
element in the following way:
<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:
<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-italic |
Italic text | Try it |
.font-weight-light |
Light 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 85% 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-center |
Indicates center-aligned text | Try it |
.text-*-center |
Indicates center-aligned text on small, medium, large or xlarge screens | 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-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.