Challenge - 5 Problems
BEM & Sass Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ selector
intermediate2:00remaining
What CSS selector does this Sass code produce?
Given the Sass code below, what is the final CSS selector generated for the
.block__element--modifier style?SASS
.block { &__element { &--modifier { color: red; } } }
Attempts:
2 left
💡 Hint
Remember that & replaces the parent selector exactly where it appears.
✗ Incorrect
The & symbol in Sass replaces the parent selector. Here, &__element becomes .block__element, and then &--modifier becomes .block__element--modifier.
📝 Syntax
intermediate2:00remaining
Which option causes a syntax error in Sass when combining & with BEM naming?
Identify which Sass snippet below will cause a syntax error due to incorrect use of & with BEM naming.
Attempts:
2 left
💡 Hint
Check for missing opening braces `{` after nested selectors.
✗ Incorrect
Option A is missing the opening curly brace `{` after `&--modifier`, causing a Sass syntax error. Sass expects `{` immediately after a selector.
❓ selector
intermediate2:00remaining
Which Sass code produces a descendant selector instead of BEM concatenated class?
Choose the Sass code that compiles to a descendant selector `.block __element` instead of the proper BEM concatenated `.block__element`.
Attempts:
2 left
💡 Hint
A space after & inserts a descendant combinator (space), preventing concatenation for BEM class names.
✗ Incorrect
Option A has a space between & and __element, so & is replaced by .block, resulting in `.block __element` (descendant selector) instead of `.block__element` (single BEM class).
❓ rendering
advanced2:00remaining
What color will the element with class
block__element--modifier have?Given the Sass code below, what color will the element with class
block__element--modifier display in the browser?SASS
.block { &__element { color: blue; &--modifier { color: red; } } }
Attempts:
2 left
💡 Hint
Look at the nested selectors and which color applies to the modifier class.
✗ Incorrect
The .block__element sets color blue, but .block__element--modifier overrides it with color red, so the element with that class will be red.
❓ accessibility
expert3:00remaining
How to improve accessibility when using BEM modifiers with & in Sass?
You have a button styled with BEM naming and Sass using & for modifiers. Which practice improves accessibility the most?
Attempts:
2 left
💡 Hint
Think about what helps screen readers and keyboard users, not just visual styles.
✗ Incorrect
Accessibility requires semantic HTML and ARIA attributes to communicate state and roles to assistive tech. CSS alone cannot provide this.