Web accessibility (a11y) ensures that websites are usable by people with disabilities. Beyond being the right thing to do, accessibility improves SEO and usability for everyone.
Semantic HTML
Use HTML elements for their intended purpose. A <button> is better than a <div> with a click handler because it's keyboard-focusable and announces itself to screen readers.
ARIA Attributes
<nav aria-label="Main navigation">
<button aria-expanded="false" aria-controls="menu">
<img alt="A sunset over the mountains">Keyboard Navigation
All interactive elements must be reachable and operable via keyboard. Test your site by unplugging your mouse.
Color Contrast
WCAG 2.1 requires a contrast ratio of at least 4.5:1 for normal text. Use tools like the WebAIM Contrast Checker to verify your palette.
Focus Management
Never use outline: none without providing an alternative focus style. Users navigating by keyboard rely on visible focus indicators.