Create a centered page heading and text with Bootstrap

Description: Make a centered heading “Welcome” with a lead paragraph under it, inside a container, with some space above and below.

Hint:

  • Use container, text-center, display-*, lead and my-5.

Solution

<div class="container text-center my-5">
  <h1 class="display-4">Welcome</h1>
  <p class="lead">This is a short introduction text under the heading.</p>
</div>
Live preview

How it works

  • my-5 adds margin on top and bottom. text-center centers the text.

Read Typography and Spacing.


Learn more about the similar topics:
Tutorials
No Content Found.
Exercises & Assignments
No Content Found.
Interview Questions & Answers
No Content Found.