HTML Best Practices Checklist
A quick pass before shipping a page. Each line links back to the page that explains the “why.”
Document structure
- Page starts with
<!DOCTYPE html> -
<html>has alangattribute -
<head>includescharset,viewport, and a unique<title> - Only one
<main>per page
Headings
- Exactly one
<h1>per page - Heading levels go in order, no skipped levels
- Headings describe content structure, not chosen for font size
See Headings and Document Outline .
Semantic structure
-
<header>,<nav>,<main>,<aside>,<footer>used instead of generic<div>s where they fit -
<article>used for standalone content,<section>for themed groupings - Multiple
<nav>elements have distinctaria-labels
See Semantic HTML and Page Landmarks .
Links and buttons
- Links navigate, buttons perform actions, neither is used for the other’s job
- Link text makes sense out of context, no bare “click here”
-
target="_blank"is paired withrel="noopener noreferrer" - No
href="#"placeholder links
See Links .
Images
- Every
<img>has analtattribute - Decorative images use
alt="" -
widthandheightare set to prevent layout shift - Large or responsive images use
srcset/sizesor<picture>
See Images and Responsive Images .
Forms
- Every input has a
<label>connected withfor/id - Placeholder text is never the only label
- Related checkboxes/radio buttons are wrapped in
<fieldset>with a<legend> - Buttons inside a form have an explicit
type
See Forms and Form Validation .
Tables
- Tables are used for tabular data only, never for page layout
- Data tables have a
<caption> - Header cells use
<th scope="col">or<th scope="row">
See Tables .
Accessibility
- Semantic HTML is used before reaching for ARIA
- Interactive elements are keyboard-reachable and show a visible focus state
-
aria-label,aria-expanded, and similar attributes are only added where they add real information
See ARIA Basics .
Media and embeds
-
<video>and<audio>havecontrols, or a custom player replaces them - Videos with spoken dialogue have captions
-
<iframe>has atitleattribute
What to read next
- HTML overview : the full learning path from the start