HTML & CSS · Beginner · 15 min
Organize a page with meaning
Use page landmarks and heading levels to organize an introduction.
Identify the main content
Use <header> for introductory content, <main> for the central content, and <footer> for closing information. A typical page has one visible <main> element. These elements help people and assistive technology understand the page. They do not automatically create a visual layout.
<header><h1>Sam’s page</h1></header>
<main><p>Welcome to my page.</p></main>
<footer><p>Made while learning HTML.</p></footer>Expected appearance
Sam’s page Welcome to my page. Made while learning HTML.
Use a heading hierarchy
Use <h2> for a major section below <h1> and <h3> for a subsection of that section. Choose heading levels for structure, not font size. A section groups a topic and usually needs a heading. A <div> is a generic container when no meaningful element fits.
<main>
<section>
<h2>About me</h2>
<p>I enjoy drawing.</p>
</section>
</main>Expected appearance
About me I enjoy drawing.
Try it yourself
Code runs on this device. When you are signed in, drafts sync to your account.
Edit the page content and include CSS in a style element. The preview supports a limited set of HTML elements. Scripts, external resources, navigation to other sites, and form submission are disabled.
Build and check
Create a <header> containing one <h1>. Add a <main> containing a <section> with an <h2> that says About me. Add a <footer> containing a paragraph.
Replace generic containers with the required landmarks. Put the <h2> inside a section inside <main>.
Show worked solution
<header><h1>Sam’s page</h1></header>
<main><section><h2>About me</h2><p>I enjoy drawing.</p></section></main>
<footer><p>Made while learning HTML.</p></footer>Replace generic containers with the required landmarks. Put the <h2> inside a section inside <main>.
Page preview
Run to preview your page. Check tests the task requirements, including the requested screen widths. Check results do not replace keyboard and visual review.
Try it yourself
- Find the main topic and the section topic in your page.
- Explain why making a heading bigger does not change its level.