Challenge - 5 Problems
State Class Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
📝 Syntax
intermediate2:00remaining
What is the output CSS of this SASS snippet?
Given this SASS code, what CSS does it generate?
.btn {
background: blue;
&:hover {
background: green;
}
&.disabled {
background: gray;
}
}SASS
.btn { background: blue; &:hover { background: green; } &.disabled { background: gray; } }
Attempts:
2 left
💡 Hint
Look at how the & symbol combines with pseudo-classes and classes.
✗ Incorrect
The & symbol in SASS appends the nested selectors to the parent. &:hover becomes .btn:hover and &.disabled becomes .btn.disabled.
🧠 Conceptual
intermediate1:30remaining
Which selector targets the active state in SASS?
You want to style a button when it is being clicked (active state). Which SASS nested selector correctly targets this state?
SASS
.btn {
// your code here
}Attempts:
2 left
💡 Hint
Active state is a pseudo-class triggered when clicking.
✗ Incorrect
The :active pseudo-class applies styles when the element is being clicked. &.active targets a class named 'active', which is different.
❓ selector
advanced2:30remaining
What CSS does this SASS produce for combined states?
Consider this SASS code:
What is the correct CSS output?
.btn {
color: black;
&:hover, &:focus {
color: blue;
}
&.disabled {
color: gray;
pointer-events: none;
}
}What is the correct CSS output?
SASS
.btn { color: black; &:hover, &:focus { color: blue; } &.disabled { color: gray; pointer-events: none; } }
Attempts:
2 left
💡 Hint
Check how multiple selectors separated by commas are expanded with &.
✗ Incorrect
The & symbol applies to each selector before the comma separately, so &:hover, &:focus becomes .btn:hover, .btn:focus.
❓ layout
advanced1:30remaining
How to disable pointer events for a disabled button in SASS?
You want to make a button unclickable and visually disabled using SASS. Which nested rule correctly disables pointer events and changes opacity?
SASS
.btn { background: green; color: white; &.disabled { // your code here } }
Attempts:
2 left
💡 Hint
Disabled means less visible and no mouse interaction.
✗ Incorrect
Setting opacity to 0.5 dims the button visually, and pointer-events: none disables mouse clicks.
❓ accessibility
expert3:00remaining
Which approach improves accessibility for disabled buttons?
You have a button styled with a .disabled class in SASS. Which additional attribute or practice improves accessibility for keyboard and screen reader users?
SASS
.btn.disabled { opacity: 0.5; pointer-events: none; }
Attempts:
2 left
💡 Hint
Disabled elements should not be focusable and should announce their state.
✗ Incorrect
aria-disabled="true" informs assistive tech the button is disabled, and tabindex="-1" removes it from keyboard focus.