Menu
×
   ❮     
HTML CSS JAVASCRIPT SQL PYTHON JAVA PHP HOW TO W3.CSS C C++ C# BOOTSTRAP REACT MYSQL JQUERY EXCEL XML DJANGO NUMPY PANDAS NODEJS DSA TYPESCRIPT ANGULAR ANGULARJS GIT POSTGRESQL MONGODB ASP AI R GO KOTLIN SWIFT SASS VUE GEN AI SCIPY AWS CYBERSECURITY DATA SCIENCE INTRO TO PROGRAMMING BASH RUST

Web Development Project: Hero Section


Project: Create a Hero Section

Now that you know how to use HTML attributes and simple styles, let's improve the top of your web page by creating a clean and beautiful hero section.

A hero section is the large heading area at the top of many modern websites. In this project, you will add a styled heading and a short description to your existing HTML page.

This hero section adds background color, padding, and centered text using the style attribute:

Welcome to My Page

Hello! My name is Liam. This is my very first web page.

Example

<div style="background-color:lightblue; padding:50px; text-align:center;">
  <h1>Welcome to My Page</h1>
  <p>Hello! My name is <b>Liam</b>. This is my very first web page.</p>
</div>
Try it Yourself »

Here, the style attribute controls the look of the hero section:

  • background-color sets the background color
  • padding adds space inside the box
  • text-align centers the text

Next, you will learn how to add comments inside your HTML code - useful for notes and reminders that do not appear on the page.

Next » HTML Comments


×

Contact Sales

If you want to use W3Schools services as an educational institution, team or enterprise, send us an e-mail:
sales@w3schools.com

Report Error

If you want to report an error, or if you want to make a suggestion, send us an e-mail:
help@w3schools.com

W3Schools is optimized for learning and training. Examples might be simplified to improve reading and learning. Tutorials, references, and examples are constantly reviewed to avoid errors, but we cannot warrant full correctness of all content. While using W3Schools, you agree to have read and accepted our terms of use, cookies and privacy policy.

Copyright 1999-2025 by Refsnes Data. All Rights Reserved. W3Schools is Powered by W3.CSS.