SimpleTuts.com

Creating a Basic Hero Section

Learn How to Create a Simple Hero Section Using HTML

In this chapter, students will learn how to create a very basic Hero Section using simple HTML with inline CSS. This beginner-friendly approach avoids complexity and focuses on understanding the basics.

Chapter Goal

What is a Hero Section?

A Hero Section is the top visible area of a website. It usually contains:

In this chapter, we will create a simple hero banner using only one <div>.

Step 1: Create a Basic HTML File

Create a new file named index.html.


<html>
<head>
</head>

<body style="margin:0px;">

</body>
</html>
        
Run Code

margin:0px removes the default space around the page.

Step 2: Add the Hero Section

Inside the <body> tag, add the following code:


<div style="background-color:dodgerblue; color:white; padding:50px;">
    <h1>Welcome to ABC Interiors</h1>
    <p>Let's create your perfect home</p>
</div>
        
Run Code

Explanation

Final Output Code

This is the complete final code for this chapter.


<html>
<head>
</head>

<body style="margin:0px;">

    <div style="background-color:dodgerblue; color:white; padding:50px;">
        <h1>Welcome to ABC Interiors</h1>
        <p>Let's create your perfect home</p>
    </div>

</body>
</html>
        
Run Code

View Output

  1. Save the file
  2. Open index.html in a browser
  3. You will see a blue hero section at the top

Beginner Notes

Practice Task

  1. Change the background color
  2. Change the heading text
  3. Increase or decrease the padding value

Chapter Summary

Watch video