Accessible markup
Writing accessible HTML and CSS.
Semantic markup
- Avoid
divwhen there’s a better semantic fit.- e.g.
main,header,footer,nav,article,section
- e.g.
- Have a correct heading structure.
- Exactly one
h1on the page - Don’t skip levels, e.g. no
h1>h3with no interveningh2 - This may also benefit SEO, though I’m not clear if directly or indirectly.
- Exactly one
Interactivity
- Don’t build interactive elements out of non-semantic markup
- e.g. Don’t make a button out of a
<div>with JavaScript; use<button> - If for some reason you must do this, annotate with ARIA roles.
- e.g. Don’t make a button out of a
Test with a screen reader
Accessibility issues often only become clear in context. Everyone on the team should be comfortable testing with a screen reader.
- Windows: NVDA (free), JAWS (paid, muy expensive)
- Mac: VoiceOver
- Linux: Orca