In this post, I will present to you the Jumbotron and Jumbotron-Fluid, which are new components in Bootstrap 4 Beta. As the name suggests (jumbo+tron), the Jumbotron class can increase the size of headings and add margins for the content displayed on a landing page Jumbotron.
Jumbotron shows a big box that highlights some special information or content.
To get a jumbotron of full width, and without rounded corners use the .jumbotron class outside all .container classes and instead add a .container within, as shown in the following example −
Tip: Inside a jumbotron, you can put nearly any valid HTML, including other Bootstrap 4 Beta elements/classes.
Use a <div> element
with a class to create your.jumbotron
. You have 2 types of Jumbotron in Bootstrap 4 Beta:
1. Jumbotron
The code snippet:
<div class="jumbotron"> <h1 class="display-3">Hello, world!</h1> <p class="lead">This is a simple hero unit, a simple jumbotron-style component for calling extra attention to featured content or information.</p> <hr class="my-2"> <p>It uses utility classes for typography and spacing to space content out within the larger container.</p> <p class="lead"> <a class="btn btn-primary btn-lg" href="#" role="button">Some action</a> </p> </div>
Preview:
2. Jumbotron Fluid
The Code
<div class="jumbotron jumbotron-fluid"> <div class="container"> <h1 class="display-3">Fluid jumbotron</h1> <p class="lead">This is a modified jumbotron that occupies the entire horizontal space of its parent.</p> </div> </div>
Preview
See it in action here.
Code Explained.
- Create a <div> that acts as a .container.
- Inside this <div> create another <div> with the class of .jumbotron.
- Next, add HTML headings to see the Jumbotron effect using the .jumbotron class.
- After we execute this HTML code, we can clearly observe that in addition to a larger <h1> heading, the font-weight has been reduced to 200px.
Conclusion
In this blog post, we discussed the jumbotron class feature that is available in Bootstrap 4 Beta along with various examples which cover full simple, rounded corners and fluid aspects of Jumbotron.