Challenge - 5 Problems
Nested Lists Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ rendering
intermediate2:00remaining
What is the visual output of this nested list?
Look at the HTML code below. What will you see rendered in the browser?
HTML
<ul> <li>Fruit <ul> <li>Apple</li> <li>Banana</li> </ul> </li> <li>Vegetables <ul> <li>Carrot</li> <li>Broccoli</li> </ul> </li> </ul>
Attempts:
2 left
💡 Hint
Nested
- inside
- creates sub-bullets.
✗ Incorrect
The outer
- creates main bullets. Each
- can contain another
- for nested bullets. So Apple and Banana appear indented under Fruit, and Carrot and Broccoli under Vegetables.
❓ selector
intermediate2:00remaining
Which CSS selector targets only the nested list items?
Given this HTML structure with nested lists, which CSS selector will style only the inner list items (like Apple, Banana, Carrot, Broccoli)?
HTML
<ul> <li>Fruit <ul> <li>Apple</li> <li>Banana</li> </ul> </li> <li>Vegetables <ul> <li>Carrot</li> <li>Broccoli</li> </ul> </li> </ul>
Attempts:
2 left
💡 Hint
Think about selecting list items inside another list inside list items.
✗ Incorrect
The selector 'ul li ul li' means: inside a ul, find li, then inside that li find a ul, then inside that ul find li. This targets only nested list items, not the top-level ones.
🧠 Conceptual
advanced1:30remaining
Why use nested lists in HTML?
Which is the best reason to use nested lists in a webpage?
Attempts:
2 left
💡 Hint
Think about how nested lists help organize information.
✗ Incorrect
Nested lists help show relationships between items, like categories and subcategories, making content easier to understand.
❓ accessibility
advanced1:30remaining
How to improve accessibility of nested lists?
Which practice improves accessibility for nested lists in HTML?
Attempts:
2 left
💡 Hint
Think about screen readers and semantic meaning.
✗ Incorrect
Using proper semantic HTML with
- and
- tags helps screen readers understand the list structure and hierarchy, improving accessibility.
❓ layout
expert2:30remaining
How to create a horizontal nested list menu with CSS?
You want a horizontal main menu with vertical dropdown submenus using nested lists. Which CSS snippet correctly achieves this layout?
HTML
<nav> <ul class="menu"> <li>Home</li> <li>Services <ul class="submenu"> <li>Design</li> <li>Development</li> </ul> </li> <li>Contact</li> </ul> </nav>
Attempts:
2 left
💡 Hint
Use flexbox for horizontal main menu and hide/show submenu on hover.
✗ Incorrect
Setting .menu to flex makes main items horizontal. Hiding .submenu by default and showing it on hover creates dropdown effect. Position absolute places submenu correctly.