Pages need structure
Without structure, you just have tag soup.
Structure helps users, screen readers, search engines, and you.
HTML is a hierarchy, not just a bunch of tags.
Building accessible interfaces with semantic HTML
Without structure, you just have tag soup.
Structure helps users, screen readers, search engines, and you.
HTML is a hierarchy, not just a bunch of tags.
Define sections of the page.
Landmark regions group related content.
Screen readers allow jumping by region, but only if these regions exist.
Accessible names are important for these sections so users can understand what they are.
or
or
Usually a header for the entire page, but can also be a header for a section or article.
or
or
Site or section navigation. Usually contains a list of links.
If there are more than one, be sure to assign accessible names.
Use accessible names to distinguish multiple regions of the same type.
or
or
The core content of the page.
or
or
Tangential content, callouts, ads, search, etc.
or
or
Usually the footer for the entire page, but can also be a footer for a section or article.
These elements are not for styling - they are for imparting meaning to different bits of content.
All of the content on the page should be inside one of these containers.
nav can be inside the header, footer, aside, etc. But the others should be at the top level of the document and not nested inside one another.
Independent content blocks.
section is a meaningful group of content, e.g. the hero section.
article is a complete composition contained in the document, e.g. a blog post.
Can be helpful for organizing content like:
Semantic elements help you create nested meaning — not just layout.
Don't use headings just for size - use them for structure.
Don't skip levels.
Use CSS to adjust style and size as needed.
Neutral container, has no semantic meaning.
Can be styled with CSS, used to group content.
Not every <div> is bad - but they should be intentional and deliberate.
Key takeaways: