Imported from grant-wilson/agent-skills (
skills/html-standards/SKILL.md). Install upstream withnpx skills add grant-wilson/agent-skills --skill html-standards. Copyright stays with the author.
- Use the element that names the content:
<header>,<nav>,<main>(exactly one per page),<article>,<section>,<aside>,<footer>,<button>for actions,<a>for navigation. A<div>or<span>is a last resort for pure styling hooks, never for interactive behavior. - Reach for native semantics before ARIA — a
<button>needs noroleor key handlers. When ARIA is unavoidable, follow the APG pattern completely (role, states, and keyboard support together). Every page must be operable by keyboard alone, with a logical heading outline (one<h1>, no skipped levels) and visible focus indicators.
<button type="button" aria-expanded="false" aria-controls="filters">
Filters
</button>
- Every
<img>has analtattribute — descriptive for informative images, empty (alt="") for decorative ones. Set explicitwidth/height(oraspect-ratioin CSS) to prevent layout shift, andloading="lazy"on below-the-fold images. - Every control gets a programmatically associated
<label>. Use the specific input type (email,tel,date,number) andautocompletetokens so browsers and password managers can help. Surface validation errors in text associated viaaria-describedby, never by color alone.
<label for="work-email">Work email</label>
<input id="work-email" type="email" name="email" autocomplete="work email"
required
aria-describedby="work-email-error" />
<p id="work-email-error" role="alert" hidden>Enter a valid email address.</p>
- Prefer built-in behavior over JavaScript re-implementations:
<dialog>withshowModal()for modals,<details>/<summary>for disclosure, thepopoverattribute for popovers, and<datalist>for suggestions. - No
styleattributes, no inline<script>bodies, and no inline event handlers (onclick="…"). Keep markup CSP-compatible: styles live in stylesheets, behavior in external modules loaded withtype="module"anddefersemantics. - Every document declares
<!doctype html>,<html lang="…">,<meta charset="utf-8">, a<meta name="viewport">, and a unique, descriptive<title>.