Skip to content
Parwaz DigitalMarketing · Web · Courses

Web Development Course · Module 2, lesson 5

Building accessible, responsive components

Combine responsive layout and accessibility basics to build a navigation menu, buttons and cards that work for every visitor on every screen.

What you will learn

  • Build a navigation menu that adapts from mobile to desktop
  • Check colour contrast, tap target size and keyboard access
  • Use correct HTML elements so components work with assistive technology

A responsive component should work for everyone, not just look right. Start with the correct elements: links that go somewhere should be <a> elements, and controls that do something should be <button> elements. These are keyboard accessible by default. A <div> with a click handler is not, and screen readers do not announce it as a control, so avoid using one in place of a button.

Check colour contrast between text and its background. The WCAG guidelines ask for a contrast ratio of at least 4.5 to 1 for normal body text, and browser developer tools can measure it. On touch screens, make buttons and links large enough to tap comfortably, with space between them. Never remove focus outlines unless you replace them with a clearly visible alternative.

Navigation is a common challenge. On wide screens, links can sit in a row. On phones, a common pattern is a menu button that shows and hides the links. The button should say what it does, for example with visible text or an aria-label, and should report whether the menu is open using aria-expanded. You will add the toggle behaviour with JavaScript in the next module.

Practice task

Build a responsive navigation bar for your bakery site in Tailwind with the links in a row on desktop and stacked on mobile, then check every text colour with a contrast checker.

Web Development Course

Learn this properly,with a final project.

These pages summarise each lesson. The full course teaches them hands-on. Message us for the current fee, schedule, and format.

Available for new projects — Replies within one business day