0
0
SASSmarkup~20 mins

@extend directive in SASS - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Sass @extend Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
What does the @extend directive do in Sass?
Choose the best description of what the @extend directive does in Sass.
AIt imports external CSS files into the current Sass file.
BIt copies all styles from one selector to another, merging their rules.
CIt defines a new variable that can be reused in styles.
DIt creates a new mixin that can be included in other selectors.
Attempts:
2 left
💡 Hint
Think about how Sass helps avoid repeating the same styles in multiple places.
📝 Syntax
intermediate
2:00remaining
Which Sass code correctly uses @extend to share styles?
Select the option that correctly uses @extend to make .button-primary share styles from .button.
A.button-primary { @extend .button; color: blue; }
B.button-primary { @extend #button; color: blue; }
C.button-primary { extend .button; color: blue; }
D.button-primary { @include extend(.button); color: blue; }
Attempts:
2 left
💡 Hint
Remember the exact syntax for @extend and how selectors are referenced.
rendering
advanced
2:00remaining
What CSS output results from this Sass code using @extend?
Given this Sass code, what is the compiled CSS output?
SASS
.alert { border: 1px solid red; padding: 1rem; }
.error { @extend .alert; background: pink; }
A.error { border: 1px solid red; padding: 1rem; background: pink; }
B
.alert { border: 1px solid red; padding: 1rem; }
.error { border: 1px solid red; padding: 1rem; background: pink; }
C
.alert { border: 1px solid red; padding: 1rem; }
.error { background: pink; }
D
.alert, .error { border: 1px solid red; padding: 1rem; }
.error { background: pink; }
Attempts:
2 left
💡 Hint
Think about how @extend merges selectors in the output CSS.
selector
advanced
2:00remaining
Which selector will NOT be matched by @extend in this Sass code?
Given the Sass code below, which selector will NOT be extended by .card?
SASS
.box { padding: 1rem; }
.container .box { margin: 2rem; }
.card { @extend .box; }
A.box
B.card
C.container
D.container .box
Attempts:
2 left
💡 Hint
Remember @extend only matches selectors exactly or with nesting, not unrelated selectors.
accessibility
expert
3:00remaining
How can using @extend affect CSS accessibility and maintainability?
Which statement best explains a potential accessibility or maintainability issue caused by improper use of @extend?
AExtending selectors can create unexpected combined styles that confuse screen readers if semantic classes are mixed.
BUsing @extend always improves accessibility by reducing CSS size and speeding up page load.
CThe @extend directive automatically adds ARIA attributes to extended selectors.
D@extend duplicates all styles, increasing CSS file size and slowing down rendering.
Attempts:
2 left
💡 Hint
Think about how combining unrelated selectors might affect semantic meaning and style clarity.