Bird
Raised Fist0
HTMLmarkup~20 mins

Semantic elements and screen readers in HTML - Practice Problems & Coding Challenges

Choose your learning style10 modes available
Challenge - 5 Problems
🎖️
Semantic Accessibility Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
Why use semantic elements for screen readers?
Which of the following best explains why semantic HTML elements help screen readers?
AThey prevent users from copying text on the page.
BThey make the page load faster by reducing file size.
CThey automatically add colors and fonts to improve readability.
DThey provide meaningful structure that screen readers use to navigate content easily.
Attempts:
2 left
💡 Hint
Think about how screen readers understand page layout and content.
📝 Syntax
intermediate
2:00remaining
Identify the semantic element for main content
Which HTML element is best to wrap the main content of a page for screen readers?
A<main>
B<section>
C<div>
D<article>
Attempts:
2 left
💡 Hint
This element is specifically designed to hold the main content unique to the page.
❓ rendering
advanced
2:00remaining
Screen reader behavior with landmarks
Given this HTML snippet, what will a screen reader announce when focusing on the <nav> element?
HTML
<nav aria-label="Primary navigation">
  <ul>
    <li><a href="#home">Home</a></li>
    <li><a href="#about">About</a></li>
  </ul>
</nav>
ANo announcement because <nav> is not recognized
BList with 2 items, Home, About
CNavigation region, Primary navigation, list with 2 items
DLink Home, Link About
Attempts:
2 left
💡 Hint
Screen readers announce landmarks and their labels to help users understand page sections.
❓ selector
advanced
2:00remaining
CSS selector for focus style on semantic landmarks
Which CSS selector correctly applies a visible focus outline to all semantic landmark elements when they receive keyboard focus?
Anav:focus, main:focus, aside:focus, footer:focus { outline: 3px solid blue; }
Bnav.focus, main.focus, aside.focus, footer.focus { outline: 3px solid blue; }
Cnav:active, main:active, aside:active, footer:active { outline: 3px solid blue; }
Dnav:hover, main:hover, aside:hover, footer:hover { outline: 3px solid blue; }
Attempts:
2 left
💡 Hint
Focus styles appear when elements receive keyboard focus, not on hover or active states.
❓ accessibility
expert
2:00remaining
Screen reader announcement with incorrect semantic use
What error will a screen reader encounter when a page uses multiple <main> elements?
AIt will ignore all <code>&lt;main&gt;</code> elements except the first one.
BIt will announce each <code>&lt;main&gt;</code> as a separate main region causing confusion.
CIt will crash and stop reading the page.
DIt will treat all <code>&lt;main&gt;</code> elements as <code>&lt;div&gt;</code> with no special meaning.
Attempts:
2 left
💡 Hint
The <main> element should be unique per page for clear navigation.

Practice

(1/5)
1. Which HTML element is most semantic for marking the main content of a webpage that screen readers should focus on?
easy
A. <main>
B. <div>
C. <span>
D. <section>

Solution

  1. Step 1: Understand the purpose of semantic elements

    Semantic elements describe the role of content, helping screen readers know what is important.
  2. Step 2: Identify the element for main content

    The <main> element specifically marks the main content unique to the page, guiding screen readers effectively.
  3. Final Answer:

    <main> -> Option A
  4. Quick Check:

    Main content uses <main> tag for screen readers [OK]
Hint: Main content uses <main> tag for screen readers [OK]
Common Mistakes:
  • Using <div> which has no semantic meaning
  • Confusing <section> with main content
  • Using <span> which is inline and non-semantic
2. Which of the following is the correct syntax to define a navigation section that screen readers recognize as a menu?
easy
A. <nav> ... </nav>
B. <navigation> ... </navigation>
C. <menu> ... </menu>
D. <section role='navigation'> ... </section>

Solution

  1. Step 1: Recall the semantic tag for navigation

    The <nav> element is the standard semantic tag for navigation menus.
  2. Step 2: Check syntax correctness

    <nav> ... </nav> is valid HTML5 syntax recognized by screen readers.
  3. Final Answer:

    <nav> ... </nav> -> Option A
  4. Quick Check:

    Navigation uses <nav> tag [OK]
Hint: Use <nav> for navigation menus [OK]
Common Mistakes:
  • Using non-existent <navigation> tag
  • Confusing <menu> with <nav> (menu is different)
  • Using <section> without role attribute
3. What will a screen reader announce first when reading this HTML snippet?
<header>
  <h1>Welcome</h1>
</header>
<main>
  <p>Hello world!</p>
</main>
medium
A. It will read the entire page as one block
B. "Hello world!" from the paragraph
C. It will skip the header and read main only
D. "Welcome" from the header's h1

Solution

  1. Step 1: Understand screen reader reading order

    Screen readers read semantic elements in document order, starting with header content.
  2. Step 2: Identify first readable text

    The <header> contains an <h1> with "Welcome", so it reads this first.
  3. Final Answer:

    "Welcome" from the header's h1 -> Option D
  4. Quick Check:

    Header content is read before main content [OK]
Hint: Screen readers read header before main content [OK]
Common Mistakes:
  • Assuming main content reads first
  • Thinking header is skipped
  • Believing screen reader reads all at once
4. Identify the error in this HTML snippet that affects screen reader accessibility:
<div role='main'>
  <h2>Content</h2>
</div>
medium
A. Missing aria-label on the div
B. Using role='main' on a div instead of <main>
C. h2 should be h1 inside main
D. The div should have tabindex='0' for focus

Solution

  1. Step 1: Check semantic correctness

    While role='main' can be used, the semantic <main> element is preferred for accessibility.
  2. Step 2: Understand best practice for screen readers

    Using <main> provides built-in semantic meaning and better support than a div with role.
  3. Final Answer:

    Using role='main' on a div instead of <main> -> Option B
  4. Quick Check:

    Use <main> tag, not div with role [OK]
Hint: Prefer <main> over div with role='main' [OK]
Common Mistakes:
  • Thinking role='main' on div is equal to <main>
  • Ignoring heading level importance
  • Adding tabindex unnecessarily
5. You want to create a webpage section that screen readers identify as a complementary sidebar. Which semantic element and ARIA attribute combination is best?
hard
A. <nav aria-label='Sidebar'>
B. <section role='complementary'>
C. <aside> without extra ARIA attributes
D. <div role='complementary'>

Solution

  1. Step 1: Identify semantic element for complementary content

    The <aside> element is designed for complementary content like sidebars.
  2. Step 2: Check ARIA attribute necessity

    <aside> already implies complementary role, so extra ARIA roles are unnecessary and may confuse screen readers.
  3. Final Answer:

    <aside> without extra ARIA attributes -> Option C
  4. Quick Check:

    Use <aside> for complementary content [OK]
Hint: Use <aside> for sidebars, no extra ARIA needed [OK]
Common Mistakes:
  • Adding redundant ARIA roles to <aside>
  • Using <section> or <div> without semantic meaning
  • Confusing <nav> with sidebar role
Recommended

Ready to prove it?

Pass the test and this pattern moves unknown strong while earning +1 Grip toward your certificate.

10 questions~5 mineasy hard