Bootstrap4 Typography
Bootstrap 4 Default Settings
Bootstrap 4's defaultfont-sizeis 16px,line-heightis 1.5.
The defaultfont-familyis "Helvetica Neue", Helvetica, Arial, sans-serif.
Furthermore, all<p>elementsmargin-top: 0 、 margin-bottom: 1rem (16px)。
<h1> - <h6>
Bootstrap defines styles for all HTML headings (h1 to h6). See the example below:
Example
Try it yourself »
Display Heading Classes
Bootstrap also provides four Display classes to control heading styles: .display-1, .display-2, .display-3, .display-4.
Example
Try it yourself »
<small>
In Bootstrap 4, HTML<small>element is used to create smaller, lighter-colored text:
Example
Try it yourself »
<mark>
Bootstrap 4 defines<mark>as having a yellow background and some padding:
Example
Try it yourself »
<abbr>
Bootstrap 4 defines HTML<abbr>element's style as a dashed border displayed at the bottom of the text:
Example
Try it yourself »
<blockquote>
For quoted content, you can add the<blockquote>to the.blockquoteclass:
Example
Try it yourself »
<dl>
Bootstrap 4 defines HTML<dl>element's style as follows:
Example
Try it yourself »
<code>
Bootstrap 4 defines HTML<code>element's style as follows:
Example
Try it yourself »
<kbd>
Bootstrap 4 defines HTML<kbd>The element's styles are as follows:
Example
Try it Yourself »
<pre>
Bootstrap 4 defines HTML<pre>The element's styles are as follows:
Example
Try it Yourself »
More Typography Classes
The table below provides more examples of Bootstrap 4 typography classes:
| Class | Description | Example |
|---|---|---|
| .font-weight-bold | Bold text | Try it |
| .font-weight-normal | Normal text | Try it |
| .font-weight-light | Lighter text | Try it |
| .font-italic | Italic text | Try it |
| .lead | Make a paragraph stand out | Try it |
| .small | Specify smaller text (85% of the parent element) | Try it |
| .text-left | Left aligned | Try it |
| .text-center | Center aligned | Try it |
| .text-right | Right aligned | Try it |
| .text-justify | Set text alignment; text in paragraphs that exceeds the screen will automatically wrap. | Try it |
| .text-nowrap | Text that exceeds the screen in a paragraph does not wrap. | Try it |
| .text-lowercase | Set text to lowercase | Try it |
| .text-uppercase | Set text to uppercase | Try it |
| .text-capitalize | Set the first letter of each word to uppercase | Try it |
| .initialism | Displays text in the <abbr> element in a small font and can convert lowercase letters to uppercase. | Try it |
| .list-unstyled | Removes the default list style and left-aligns list items (in <ul> and <ol>). This class only applies to direct child list items. (If you need to remove nested list items, you need to apply this style to the nested list.) | Try it |
| .list-inline | Place all list items on the same line | Try it |
| .pre-scrollable | Make the <pre> element scrollable. The maximum height of the code block area is 340px. Once it exceeds this height, a scrollbar will appear on the Y-axis. | Try it |