Bootstrap 5 Tutorial
The font-size and line-height defaults for Bootstrap 5 are 1rem (16px) and 1.5, respectively.
Furthermore, margin-bottom: 1rem (16px by default) and margin-top: 0 are applied to every <p> element.
HTML headings (<h1> to <h6>) styled using Bootstrap 4 With a larger font size and a bolder font weight:
If desired, you can additionally apply the .h1 to .h6 classes to other components to make them function as headings:
h1 Bootstrap heading
h2 Bootstrap heading
h3 Bootstrap heading
h4 Bootstrap heading
h5 Bootstrap heading
h6 Bootstrap heading
There are six classes of display headings, which are used to stand out more than regular headings (bigger font-size and lighter font-weight): .display-1 to .display-6:
Using the .small class and the HTML <small> element, Bootstrap 5 allows you to add a smaller secondary text to any heading:
<mark> and .mark will be styled by Bootstrap 5 with a yellow background and some padding:
Use the mark element to highlight text.
The HTML <abbr> element will be styled by Bootstrap 5 with a dotted border at the bottom and a hovering question mark-equipped cursor:
The WHO was founded in 1948.
To quote content blocks from another source, add the .blockquote class to a <blockquote>. Additionally,-9 use the .blockquote-footer 8class when mentioning a source, such as “from WWF’s website”:
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.
Using Bootstrap 5, the HTML <dl> element will be styled as follows:
Coffee
– black hot drink
Milk
– white cold drink
The HTML <code> element will be styled as follows by Bootstrap 5:
The following HTML elements: span, section, and div defines a section in a document.
The HTML <kbd> element will be styled as follows by Bootstrap 5:
Use ctrl + p to open the Print dialog box.
The HTML <pre> element will be styled as follows by Bootstrap 5:
Text in a pre element
is displayed in a fixed-width
font, and it preserves
both spaces and
line breaks.
You can add the following Bootstrap 5 classes to further style HTML elements:
| Class | Description | Example |
|---|---|---|
.lead | Makes a paragraph stand out | Try it |
.text-start | Indicates left-aligned text | Try it |
.text-break | Prevents long text from breaking layout | Try it |
.text-center | Indicates center-aligned text | Try it |
.text-decoration-none | Removes the underline from a link | Try it |
.text-end | Indicates right-aligned 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 |
CodingAsk.com is designed for learning and practice. Examples may be made simpler to aid understanding. Tutorials, references, and examples are regularly checked for mistakes, but we cannot guarantee complete accuracy. By using CodingAsk.com, you agree to our terms of use, cookie, and privacy policy.
Copyright 2010-2024 by Refsnes Data. All Rights Reserved.