At the end of this Tutorial you will be able to:
You can view a finished version of the sample web page you will be working with in this Tutorial by clicking the image or text link below. The finished sample will open in a new tab of your web browser.
hero-basic.htmlResearch has shown that a typical web user will form an opinion about a web page in just 50 milliseconds after the page loads on their screen.
So-called hero blocks (sometimes known as jumbotrons) are large and typically rectangular areas at the very top of a web page. They are the first item seen by users, and are intended to capture their attention and engage their interest in the web page.
Because the fill most of the top of the user's screen, hero blocks are often referred to as displaying above the fold. This term comes from the era when newspapers were printed on large sheets of paper. And, when placed in shops, they were folded in half so that only the top half of the paper was visible to customers. For this reason, newspapers printed their most attention-grabbing headlines and images above the fold.
On mobile, tablet, laptop and desktop screens, above the fold content is what the users can see without needing to scroll down the web page.
In the next two Tutorials, you will learn how to create hero blocks with background images and background videos. However, not every hero block needs to use images or videos. See the examples below.
In tnis Tutorial, you will work with five examples of basic, text-only hero blocks.
In this exercise, you will work with the following two files, a web page and a stylesheet:
You have now saved the two files you need for this exercise.
In this section, you will update the styles of the hero-1 block within your sample files.
Your first task is to update the background colour of the hero-1 container.
.hero-1 { background-image: linear-gradient(90deg, #ff00cc, #333399); }
Your second task is to add a Google Font for all the text within the hero-1 container. The Google Font named Open Sans has already been added to the web page and is available to your CSS file.
.hero-1 h1 { font-family: 'Open Sans', sans-serif; ... }
.hero-1 h2 { font-family: 'Open Sans', sans-serif; ... }Note: The three dots ... simply refer to all the other styles for the CSS selector. Do not type or paste the three dots.
In this section, you will update the styles of the hero-2 block within your sample files. This second hero block has a similar structure to hero-1 block.
Your first task is to update the background colour of the hero-2 container.
.hero-2 { background-color: #1f364d; }
Your next task is to add Google Fonts for the text within the hero-2 container. The Google Fonts named Libre Baskerville and Open Sans have already been added to the web page and are available to your CSS file.
.hero-2 h1 { font-family: 'Libre Baskerville', sans-serif; ... }
.hero-2 h2 { font-family: 'Open Sans', sans-serif; ... }
In this section, you will update the styles of the hero-3 block within your sample files.
Your first task is to update the background colour of the hero-3 container.
.hero-3 { background-color: #fabbb6; }
Your next task is to add Google Fonts for the text within the hero-3 container. The Google Fonts named Fjalla One and Open Sans have already been added to the web page and are available to your CSS file.
.hero-3 h1 { font-family: 'Fjalla One', sans-serif; ... }
.hero-3 h2 { font-family: 'Open Sans', sans-serif; ... }
In this section, you will update the styles of the hero-4 block within your sample files.
Unlike previous hero blocks, the content of this block is left-aligned rather than centre-aligned.
Your first task is to update the background colour of the hero-4 container.
.hero-4 { background-color: #3c1c78; }
Your next task is to add Google Fonts for the text within the hero-4 container. The Google Fonts named Roboto Slab and Roboto have already been added to the web page and are available to your CSS file.
.hero-4 h1 { font-family: 'Roboto Slab', sans-serif; ... }
.hero-4 h2 { font-family: 'Roboto', sans-serif; ... }
In this section, you will update the styles of the hero-5 block within your sample files.
This hero block has only a main heading but no sub-heading, and is left-aligned.
Your first task is to update the background colour of the hero-5 container.
.hero-5 { background-color: #fbf5eb; }
Your next task is to add Google Fonts for the text within the hero-5 container. The Google Font named Libre Baskerville has already been added to the web page and are available to your CSS file.
.hero-5 h1 { font-family: 'Libre Baskerville', sans-serif; ... }
In your next task you will animate the text headlines for the hero-1 and hero-2 blocks so that they slide in from the top (hero-1) and from the left (hero-2) of the web page.
To generate the CSS code required for the animation effect, you will use the Animista website created by Ana Travas.
You will create the following two new classes in your hero-basic.css stylesheet:
You can then apply these classes to elements in your linked hero-basic.html web page.
Follow these steps to create the slide-in-top class in your hero-basic.css stylesheet.
.slide-in-top { -webkit-animation: slide-in-top 0.5s cubic-bezier(0.250, 0.460, 0.450, 0.940) both; animation: slide-in-top 0.5s cubic-bezier(0.250, 0.460, 0.450, 0.940) both; }
/* ---------------------------------------------- * Generated by Animista on 2020-4-8 10:45:15 * Licensed under FreeBSD License. * See http://animista.net/license for more info. * w: http://animista.net, t: @cssanimista * ---------------------------------------------- */ /** * ---------------------------------------- * animation slide-in-top * ---------------------------------------- */ @-webkit-keyframes slide-in-top { 0% { -webkit-transform: translateY(-1000px); transform: translateY(-1000px); opacity: 0; } 100% { -webkit-transform: translateY(0); transform: translateY(0); opacity: 1; } } @keyframes slide-in-top { 0% { -webkit-transform: translateY(-1000px); transform: translateY(-1000px); opacity: 0; } 100% { -webkit-transform: translateY(0); transform: translateY(0); opacity: 1; } }You have now finished creating the slide-in-top class.
.slide-in-top { -webkit-animation: slide-in-top 1s cubic-bezier(0.250, 0.460, 0.450, 0.940) both; animation: slide-in-top 1a cubic-bezier(0.250, 0.460, 0.450, 0.940) both; }
Follow these steps to create the slide-in-left class in your hero-basic.css stylesheet.
.slide-in-left { -webkit-animation: slide-in-left 0.5s cubic-bezier(0.250, 0.460, 0.450, 0.940) both; animation: slide-in-left 0.5s cubic-bezier(0.250, 0.460, 0.450, 0.940) both; }
/* ---------------------------------------------- * Generated by Animista on 2020-4-8 10:45:15 * Licensed under FreeBSD License. * See http://animista.net/license for more info. * w: http://animista.net, t: @cssanimista * ---------------------------------------------- */ /** * ---------------------------------------- * animation slide-in-left * ---------------------------------------- */ @-webkit-keyframes slide-in-left { 0% { -webkit-transform: translateX(-1000px); transform: translateX(-1000px); opacity: 0; } 100% { -webkit-transform: translateX(0); transform: translateX(0); opacity: 1; } } @-webkit-keyframes slide-in-left { 0% { -webkit-transform: translateX(-1000px); transform: translateX(-1000px); opacity: 0; } 100% { -webkit-transform: translateX(0); transform: translateX(0); opacity: 1; } }
You have now finished creating the slide-in-left class.
You will now apply the two new animated text classes in your stylesheet to your web page.
That’s it. You have now successfully updated the exercise file of hero blocks.
Click hero-basic.html to view a finished sample of this web page in a new tab of your web browser.
In the final part of this Tutorial, you will add some icons from Font Awesome to your button-styled hyperlinks.
<!-- Link to icons for Font Awesome 5 --> <link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.14.0/css/all.min.css" rel="stylesheet" integrity="sha512-1PKOgIY59xJ8Co8+NE6FZ+LOAZKjy+KY8iq0G4B3CyeY6wYHN3yt9PW0XpSriVlkMXe40PTKnXrLnZ9+fkDaog==" crossorigin="anonymous">This adds the Font Awesome stylesheet to your web page.
In the next two sections of this Tutorial, you will add Font Awesome icons to the buttons in the first two hero blocks of your sample web page.
In your web browser, depending on your chosen icons, the two buttons should look similar to those below.
In your web browser, depending on your choosen icons, the two buttons should look similar to those below.
That’s it. You have now completed this Tutorial.
You can see an example of the finished web page at the link below.
hero-basic.htmlFollow these steps below to upload your entire Bootstrap folder to your website on GitHub.
Your uploaded web page is published on GitHub at a web address similar to the following, where username is the username you have chosen for your GitHub account:
https://username.github.io/bootstrap/hero-basic.html
It may take a few minutes for your uploaded files to appear on GitHub.
What Does Above The Fold Mean?
By Tyler Pigott at Lone Fir Creative.
Why Above the Fold of a Webpage is Important (For Marketers)
By Simranjeet Singh at Computan.
Above the Fold vs. Below the Fold: Does it Still Matter Today?
By Anthony Brebion at Adtasty Blog.
Return to Contents.