Complete the lesson quiz and earn 250 XP.
Web browsers construct two parallel representations of a web page:
When you style a <div> or <span> to visually look like a button with rounded corners and gradients, zero semantic metadata is conveyed to the accessibility tree. To a blind screen reader user, it is invisible as an actionable control—it is announced merely as generic 'text'.
The Law of Semantics: Visual styling conveys intent to sighted mouse users; semantic HTML elements convey intent to the entire spectrum of human beings and assistive technologies.
The most widespread accessibility defect on the modern web is confusing a Button with a Link:
<button> when: The user action performs an operation, triggers a state change, submits a form, opens a modal, or toggles a menu on the current page.<a> (Anchor) with href when: The user action navigates to a new URL, a different web page, or an anchor target on the same page.Why this distinction matters:
<button> elements trigger on both Space and Enter keys.<a> links trigger on the Enter key only.<div onclick="..."> breaks keyboard navigation entirely unless you manually write 50 lines of polyfill code for tabindex, keyboard listeners, and ARIA roles.Sighted users scan a webpage by visually skimming large, bold typography.
Screen reader users scan a webpage by navigating heading outlines (e.g., pressing the H key in NVDA or JAWS, or using the rotor in VoiceOver to pull up a table of contents).
The Strict Heading Rules:
<h1> per page: Represents the overall topic of the document (e.g., 'Order History' or 'Account Settings').<h1> -> <h2> -> <h3> -> <h4>.<h2> directly to <h4> because you wanted smaller font styling. (Use CSS classes to adjust font size, never heading levels!).<h3> just because its font size matches your aesthetic preference.HTML5 introduced native Landmark Elements that establish structural signposts across the document:
<header>: The banner containing site logo, global identity, and utility shortcuts.<nav>: Major navigation blocks (primary header menu, pagination, breadcrumbs).<main>: The primary, unique content of the document (there must be only one visible <main> per page).<aside>: Complementary content tangentially related to the main content (related articles, author bio, sidebars).<footer>: Colophon, copyright notices, terms of service, and secondary links.<search>: Structural container for search forms.Keyboard Shortcut: Screen reader users press the D key to jump instantly from landmark to landmark, bypassing dozens of lines of repetitive markup in seconds.
A rampant web design antipattern is omitting <label> elements and using the placeholder attribute instead to create a 'clean, minimal' form input.
Why Placeholders Fail Accessibility and Usability:
The Bulletproof Standard:
Always use an explicit <label for="email-input">Email Address</label> bound programmatically to <input id="email-input">. Clicking the label also expands the click target by focusing the input!
Writing alt text for images is not about mechanically describing every pixel. Follow W3C's Alt Text Decision Tree:
<img src="chart.png" alt="Line graph showing mobile signups increasing 42% in Q3">.<img src="decorative-flower.svg" alt="">.
alt attribute entirely is an error (the screen reader will read the raw file URL like 'image-slash-assets-slash-flower-dot-png'). An empty alt="" instructs the screen reader to silently ignore it.<button><img src="trash.svg" alt="Delete project"></button>.Why do accessibility guidelines mandate that navigation menus, search result feeds, and bulleted features use semantic list tags (<ul>, <ol>, <li>) rather than stacks of <div> tags?
The Assistive Technology Experience:
When a screen reader encounters a <ul> containing 6 <li> elements, it announces:
'List with 6 items. Item 1 of 6: Overview... Item 2 of 6: Analytics...'
This critical metadata tells the user:
The W3C Web Accessibility Initiative published the famous First Rule of ARIA:
'If you can use a native HTML element or attribute with the semantics and behavior you already require, then do so instead of re-purposing an element and adding an ARIA role, state or property.'
Consider building an expandable accordion:
<div> with role="button", tabindex="0", aria-expanded="false", custom JavaScript keydown listeners for Space and Enter, and custom focus management.<details> and <summary>. Zero JavaScript required, 100% accessible out-of-the-box on every browser, keyboard, and screen reader.ARIA is an emergency bridge for custom widgets that HTML cannot express; it is not a replacement for good HTML.
Tables are intended for relational tabular data, never for page layout.
When a screen reader traverses a well-structured data table, it continuously announces the column and row headers corresponding to the current cell:
<table>
<caption>Employee Quarterly Sales Performance (2026)</caption>
<thead>
<tr>
<th scope="col">Employee</th>
<th scope="col">Region</th>
<th scope="col">Revenue</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">Elena Rostova</th>
<td>Northern Europe</td>
<td>$142,000</td>
</tr>
</tbody>
</table>
Key Elements:
<caption>: The title of the table announced upon entry.<th scope="col"> and <th scope="row">: Explicitly ties data cells to their parent headers.Put all semantic HTML principles into practice:
You are auditing a checkout page written by an intern. You find the following markup:
<div class="checkout-box">
<div class="heading-text">Complete Your Order</div>
<div class="cart-list">
<div class="item">Wireless Mouse - $29</div>
<div class="item">USB-C Hub - $49</div>
</div>
<div class="input-box">
<input type="text" placeholder="Enter Promo Code">
</div>
<div class="submit-btn" onclick="submitOrder()">Pay Now</div>
</div>
A screen reader user navigating this component hears: 'Complete Your Order, Wireless Mouse - $29, USB-C Hub - $49, edit text, Pay Now text'. They cannot tell there is a heading, cannot tell there are 2 items in a list, have no persistent label on the promo code, and the 'Pay Now' button cannot be reached or clicked via keyboard!