0
0
SASSmarkup~20 mins

Chained extensions in SASS - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Chained Extensions Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2: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;
}
AThe button text color will be blue.
BThe button text color will be bold.
CThe button text color will be black (default).
DThe button text color will be 1.2rem.
Attempts:
2 left
💡 Hint
Remember that @extend copies styles from placeholders, and mixins add styles inside placeholders.
📝 Syntax
intermediate
2: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;
}
AIn %extended, @extend base; is missing the percent sign before base.
BIn .alert, @extend %extended; should be @include %extended; instead.
CIn %base, color: red; is invalid CSS property.
DIn %extended, font-size: 1rem; is missing a semicolon.
Attempts:
2 left
💡 Hint
Check the syntax for extending placeholders in Sass.
rendering
advanced
2: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;
}
A
.card {
  border: 1px solid black;
  background: white;
}
B
.card {
  border: 1px solid black;
  padding: 10px;
  background: white;
}
C
%base, %extended, .card {
  border: 1px solid black;
  padding: 10px;
  background: white;
}
D
.base, .extended, .card {
  border: 1px solid black;
}
.extended, .card {
  padding: 10px;
}
.card {
  background: white;
}
Attempts:
2 left
💡 Hint
Remember that placeholders do not appear in the final CSS, only selectors that extend them.
selector
advanced
2: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;
}
A
.alert {
  background-color: yellow;
}
B
%base, %warning, .alert {
  color: green;
  font-weight: bold;
  background-color: yellow;
}
C
.alert {
  color: green;
  font-weight: bold;
  background-color: yellow;
}
D
.base, .warning, .alert {
  color: green;
  font-weight: bold;
  background-color: yellow;
}
Attempts:
2 left
💡 Hint
Placeholders do not appear in the final CSS selectors, only the classes that extend them.
accessibility
expert
3:00remaining
Accessibility Impact of Chained Extensions in Sass
How can improper use of chained extensions in Sass affect accessibility of a website?
AIt changes the HTML structure, breaking semantic meaning.
BIt automatically adds ARIA roles to elements, improving accessibility.
CIt disables screen readers from reading extended elements.
DIt can cause inconsistent focus styles, making keyboard navigation difficult.
Attempts:
2 left
💡 Hint
Think about how CSS styles affect visible focus indicators and user interaction.