Challenge - 5 Problems
Nesting Navigator
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ selector
intermediate2:00remaining
What is the output of this CSS selector?
Given the CSS selector
.nav .menu .item .link, which HTML element will it select?Attempts:
2 left
💡 Hint
Think about the order of classes from left to right in the selector.
✗ Incorrect
The selector
.nav .menu .item .link means an element with class link inside an element with class item, which is inside menu, which is inside nav. The order matters and goes from left (outer) to right (inner).❓ layout
intermediate2:00remaining
How many levels of nesting does this CSS code have?
Consider this CSS snippet:
How many levels of nesting are used here?
.container { display: flex; .box { color: red; .text { font-size: 1rem; } } }How many levels of nesting are used here?
CSS
.container { display: flex; .box { color: red; .text { font-size: 1rem; } } }
Attempts:
2 left
💡 Hint
Count how many times a selector is inside another selector.
✗ Incorrect
The
.box is nested inside .container (1 level), and .text is nested inside .box (2 levels). So total nesting is 2 levels.🧠 Conceptual
advanced2:00remaining
Which CSS approach best avoids deep nesting?
You want to keep your CSS easy to read and maintain. Which approach helps avoid deep nesting?
Attempts:
2 left
💡 Hint
Think about readability and simplicity in CSS.
✗ Incorrect
Flat selectors with clear class names keep CSS simple and avoid complex nesting that is hard to read and maintain.
📝 Syntax
advanced2:00remaining
What error does this CSS code cause?
Look at this CSS snippet:
What happens if you use this in a plain CSS file?
.card { color: black; .title { font-weight: bold; } }What happens if you use this in a plain CSS file?
CSS
.card { color: black; .title { font-weight: bold; } }
Attempts:
2 left
💡 Hint
Think about what CSS supports natively versus preprocessors.
✗ Incorrect
Plain CSS does not support nesting selectors inside other selectors. This causes a syntax error.
❓ accessibility
expert3:00remaining
How does deep nesting in CSS selectors affect accessibility?
Consider a deeply nested CSS selector that styles buttons inside many layers of divs. What is a potential accessibility issue caused by this?
Attempts:
2 left
💡 Hint
Think about how dynamic content and focus styles work with CSS selectors.
✗ Incorrect
Deeply nested selectors may not apply styles to elements added dynamically or accessed via keyboard, causing focus styles to fail and hurting accessibility.