Semantic HTML tags like <header>, <nav>, and <main> give meaning to the content. This helps assistive technologies like screen readers to navigate and understand the page better.
<nav aria-label="Main navigation"> <ul> <li><a href="#home">Home</a></li> <li><a href="#about">About</a></li> </ul> </nav>
The aria-label attribute provides an accessible name for landmarks like <nav>. The value should be a string describing the landmark.
<button aria-pressed="true" style="font-size:1.2rem; padding:0.5rem 1rem;"> <strong>Toggle</strong> Mode </button>
The <strong> tag makes 'Toggle' bold. The inline style increases font size and adds padding, so the button text is larger and spaced nicely.
The :focus pseudo-class applies styles when an element receives keyboard focus. This is essential for accessibility to show which link is selected.
Flexbox lets elements grow, shrink, and reorder based on screen size. This helps users with different devices and needs by keeping content readable and accessible.