HTML / LESSON 08

Accessible by default

Build small habits that make your pages easier to use.

Beginner8 min read · estimateUpdated Nov 1, 2026
In this lessonStart with native controlsKeep focus visibleCheck the whole experienceTry it yourselfFurther reading

01Start with native controls

Buttons already support keyboard activation. Links already support navigation. A clickable div does not get these behaviors automatically.

<button type="button">Show details</button>
<a href="services.html">Explore services</a>

02Keep focus visible

Tab through your page. Every interactive element should show a visible focus indicator. Do not remove outlines without replacing them with something equally clear.

a:focus-visible, button:focus-visible {
  outline: 3px solid #2f5bea;
  outline-offset: 4px;
}

03Check the whole experience

Use meaningful headings, readable contrast, useful alt text and clear labels. Do not rely on color alone. Test keyboard access and zoom, and respect reduced-motion preferences.

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .animated-card { animation: none; }
}

04Try it yourself

Use Tab and Enter to open the details. Notice the visible focus indicator.

EDITABLE EXAMPLE

HTML & CSS only. Scripts and form submissions are disabled.

Further reading

Use the MDN learning guides and HTML Living Standard for deeper explanations and current browser guidance.

ONE STEP FURTHER

Small steps. Real understanding.

Try the example in your own project before moving on.

Progress is saved only in this browser.