Semantic HTML: header, nav, main, article, footer
A page built entirely from <div> elements can look perfect and still be a puzzle for anyone who cannot see it. Semantic elements say what each region of a page is for. Browsers, screen readers, reading modes and search engines all use that information.
The main landmarks
<header>holds introductory content: usually the logo, site name and main navigation at the top of the page. An article can have its own header too.<nav>wraps a major block of navigation links. Not every group of links needs it; reserve it for the main menu, a table of contents, or breadcrumbs. When a page has several, give each anaria-labelsuch as "Main" or "Breadcrumb".<main>contains the page's primary content. There should be one visible<main>per page, and it should not include the repeated header and footer.<footer>holds closing information: copyright, contact links, related pages.<aside>is content that is related but secondary, such as a sidebar or a "related lessons" box.
Screen readers expose these as landmarks, so a user can jump straight to the navigation or to the main content instead of listening to everything in order.
Expected page text
TetSharing Python | SQL Why semantic HTML matters Landmarks let screen-reader users jump straight to the content. Search engines Clear structure helps crawlers understand the page. Related: HTML headings © 2026 Example Co.
article and section
<article> is a self-contained piece that would make sense on its own, for example in a feed reader: a blog post, a news story, a product card, a comment. <section> groups a thematic part of a document and normally starts with a heading. If you cannot think of a heading for it, you probably want a <div>.
Where div still fits
<div> has no meaning at all, which is exactly what you want for a wrapper that exists only for styling, such as a grid container. Use <div> freely for layout; use semantic elements for meaning. The same goes for <span> inside text.
Why it helps search engines
Semantic structure does not boost rankings by itself, but it helps crawlers find the main content, separate it from navigation and boilerplate, and understand the page's headings. Combined with a clear heading outline, it is part of making a page easy to interpret.
Common mistakes
- Wrapping every block in
<section>without headings. - Several visible
<main>elements on one page. - Putting the main content inside
<aside>or the site navigation inside<main>.
Summary
header,nav,main,asideandfootermark page regions and become landmarks.articleis self-contained content;sectionis a themed part with a heading.divandspanremain the right choice for meaningless wrappers.
Quiz: Semantic layout