← Web basics: HTML, CSS and JavaScript
Semantic structure
header, nav, main, section and footer say what each part of a page is.
Most pages have the same big regions: a top bar with the site name, a menu of links, the main content, and a bottom strip with contact details. HTML has elements named after these jobs: <header>, <nav>, <main>, <section>, <article> and <footer>. They look like plain boxes, but they carry meaning (that is what "semantic" means). Screen readers let people jump straight to <main> or <nav>, search engines understand the page better, and your code is easier to read than a pile of anonymous boxes.
<header>
<h1>Green Thumb Garden Club</h1>
<nav>
<a href="#events">Events</a>
<a href="#join">Join</a>
</nav>
</header>
<main>
<section id="events">
<h2>Events</h2>
<p>Seed swap on the first Sunday of every month.</p>
</section>
</main>
<footer>
<p>Contact: hello@greenthumb.example</p>
</footer>The header holds the title and the nav menu. main holds the content that is unique to this page, split into a section with its own heading. The footer holds contact details.
A page should have exactly one <main>. <section> groups related content and usually starts with a heading. <article> is for a piece that makes sense on its own, like a blog post or a product card.
There is also <div>, a box with no meaning at all. It is fine for styling, but reach for a semantic element first when one fits.