0
0
HTMLmarkup~20 mins

List use cases in layout in HTML - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
List Layout Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
1:30remaining
Common use cases for lists in web layouts
Which of the following is NOT a typical use case for lists (
    ,
      ,
      ) in web page layouts?
AShowing a series of steps in a process
BCreating a grid layout for images
CListing features or benefits of a product
DDisplaying a navigation menu with links
Attempts:
2 left
💡 Hint
Think about what lists are good for versus what layout tools like CSS Grid do.
📝 Syntax
intermediate
1:30remaining
Correct HTML list syntax for a navigation menu
Which option shows the correct HTML structure for a navigation menu using a list?
A<nav><ul><li><a href="#home">Home</a></li><li><a href="#about">About</a></li></ul></nav>
B<nav><ol><li>Home</li><li>About</li></ol></nav>
C<nav><dl><dt>Home</dt><dd>About</dd></dl></nav>
D<nav><list><item>Home</item><item>About</item></list></nav>
Attempts:
2 left
💡 Hint
Navigation menus usually use unordered lists with links inside list items.
rendering
advanced
2:00remaining
Visual result of nested lists in layout
What will the browser display for this HTML snippet?
HTML
<ul>
  <li>Fruits
    <ul>
      <li>Apple</li>
      <li>Banana</li>
    </ul>
  </li>
  <li>Vegetables</li>
</ul>
AA bulleted list with 'Fruits' and 'Vegetables', where 'Fruits' has a nested bulleted list of 'Apple' and 'Banana'.
BA numbered list with 'Fruits' and 'Vegetables', and 'Fruits' has a nested numbered list of 'Apple' and 'Banana'.
CA paragraph with the text 'Fruits Apple Banana Vegetables' all in one line.
DAn error message because nested lists are not allowed.
Attempts:
2 left
💡 Hint
Think about how nested unordered lists render by default.
selector
advanced
1:30remaining
CSS selector to style only top-level list items
Which CSS selector will style only the top-level list items in a nested list layout?
Aul li ul li { color: blue; }
Bul li { color: blue; }
Cul > li { color: blue; }
Dli ul { color: blue; }
Attempts:
2 left
💡 Hint
Use the child combinator to select direct children only.
accessibility
expert
2:00remaining
Improving accessibility of list-based navigation
Which practice improves accessibility for a list-based navigation menu?
AUse <div> elements instead of lists and add tabindex="0" to each link.
BUse <ol> instead of <ul> for all navigation menus to indicate order.
CRemove all list tags and use only <span> elements with click handlers.
DAdd role="navigation" to the container and use semantic <ul> with <li> and <a> elements.
Attempts:
2 left
💡 Hint
Semantic HTML and ARIA roles help screen readers understand navigation.