Semantic HTML and Accessibility Basics
August 25, 2026
- HTML
- Accessibility
Semantic HTML and Accessibility Basics
A lot of accessibility advice starts with ARIA attributes, but the biggest win usually comes before that: using an element that already means what you're trying to say. Screen readers, keyboard navigation, and browser autofill all key off semantics, not appearance.
Buttons vs divs
<!-- Looks clickable, means nothing to assistive tech -->
<div onclick="submit()">Submit</div>
<!-- Focusable, keyboard-operable, announced as a button -->
<button type="button" onclick="submit()">Submit</button>A real <button> gets keyboard focus, responds to Enter and
Space, and is announced as "button" by a screen reader — all for
free. A <div> with a click handler gets none of that unless you rebuild it
by hand with tabindex, role, and key event listeners.
Landmarks
Wrapping page regions in semantic elements lets screen reader users jump straight to the part of the page they want, instead of tabbing through everything:
<header>...</header>
<nav>...</nav>
<main>
<article>...</article>
</main>
<aside>...</aside>
<footer>...</footer>Validate your html Markup
Each of these is a "landmark" that shows up in a screen reader's navigation
menu — <main> in particular should appear exactly once per page.
Labeling form fields
An input without a label is unusable for a screen reader user, and it also loses the "click the label to focus the input" behavior sighted mouse users rely on.
<label for="email">Email address</label>
<input id="email" type="email" name="email" />If you can't show a visible label, use aria-label instead of dropping the
label entirely:
<input type="search" aria-label="Search posts" />Alt text
<img src="/chart.png" alt="Monthly signups rising from 200 to 1,400" />Describe what the image conveys, not what it literally shows. If an image
is purely decorative, use alt="" so screen readers skip over it instead
of reading a meaningless filename.
When you actually need ARIA
ARIA exists to patch gaps native HTML can't cover — a custom dropdown, a
tab panel, a live region for toast notifications. The first rule of ARIA is
still: don't use it if a native element already does the job. role="button"
on a div is always worse than a <button>.
A quick checklist
- Buttons are
<button>, links are<a href="...">— not clickable<div>s. - Every form input has a
<label>. - Page regions use
<header>,<nav>,<main>,<aside>,<footer>. - Every meaningful
<img>has descriptivealttext. - Heading levels (
<h1>–<h6>) follow a logical order, without skipping.