Back to Playbook

Semantic HTML

Using HTML elements for their intended purpose to improve accessibility and SEO.

Why it matters

Semantic HTML provides meaning to web content. It allows screen readers to navigate the page structure (headings, landmarks) and helps search engines understand the importance of content. It's the foundation of an accessible web.

Semantic Playground

Visualize the document structure and how semantic elements provide meaning to assistive technologies.

Core Landmarks

<main>

The dominant content of the body. There should be only one per page.

<nav>

A section of navigation links. Helps users skip to main content.

<article>

Self-contained content that could be distributed independently (e.g., a blog post).

<aside>

Content indirectly related to the main content (e.g., sidebars, callouts).

<header>

Introductory content, typically containing navigation or a logo.

<footer>

Information about the section, such as copyright or contact links.

Semantics Checklist

  1. Buttons vs. Links

    Use <button> for actions and <a> for navigation. Don't mix them up.

  2. Heading Hierarchy

    Ensure headings (h1-h6) follow a logical order without skipping levels.

  3. Form Labels

    Always use <label> elements associated with their respective form inputs.

  4. Lists

    Use <ul>, <ol>, or <dl> for grouping items to help screen readers announce the number of items.

Previous: WCAG Guidelines Next: Contrast Ratios