Challenge - 5 Problems
Chained Extensions Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate2:00remaining
Understanding Chained Extensions in Sass
Given the Sass code below, what will be the color of the
.button element when rendered in CSS?SASS
@mixin base-style { color: blue; } %base { @include base-style; font-weight: bold; } %extended { @extend %base; font-size: 1.2rem; } .button { @extend %extended; }
Attempts:
2 left
💡 Hint
Remember that @extend copies styles from placeholders, and mixins add styles inside placeholders.
✗ Incorrect
The
.button class extends %extended, which extends %base. The %base placeholder includes the mixin that sets color: blue;. So the button text color will be blue.📝 Syntax
intermediate2:00remaining
Identify the Syntax Error in Chained Extensions
Which option contains a syntax error that will prevent Sass from compiling when chaining extensions?
SASS
%base {
color: red;
}
%extended {
@extend base;
font-size: 1rem;
}
.alert {
@extend %extended;
}Attempts:
2 left
💡 Hint
Check the syntax for extending placeholders in Sass.
✗ Incorrect
When extending a placeholder selector, you must include the percent sign. Writing @extend base; without % causes a syntax error.
❓ rendering
advanced2:00remaining
Rendered CSS from Chained Extensions
What is the rendered CSS output of the following Sass code?
SASS
%base {
border: 1px solid black;
}
%extended {
@extend %base;
padding: 10px;
}
.card {
@extend %extended;
background: white;
}Attempts:
2 left
💡 Hint
Remember that placeholders do not appear in the final CSS, only selectors that extend them.
✗ Incorrect
Placeholders like %base and %extended do not generate CSS selectors themselves. The .card class extends both, so it gets all styles combined in one block.
❓ selector
advanced2:00remaining
Selector Specificity with Chained Extensions
Given the Sass code below, which CSS selector will be generated for the
.alert class?SASS
%base {
color: green;
}
%warning {
@extend %base;
font-weight: bold;
}
.alert {
@extend %warning;
background-color: yellow;
}Attempts:
2 left
💡 Hint
Placeholders do not appear in the final CSS selectors, only the classes that extend them.
✗ Incorrect
Only the
.alert class appears in the CSS selector. It inherits styles from %base and %warning via chained extensions.❓ accessibility
expert3:00remaining
Accessibility Impact of Chained Extensions in Sass
How can improper use of chained extensions in Sass affect accessibility of a website?
Attempts:
2 left
💡 Hint
Think about how CSS styles affect visible focus indicators and user interaction.
✗ Incorrect
If chained extensions override or omit focus styles, keyboard users may not see which element is focused, harming accessibility.