The selector to extend must include the dot for class selectors.
Step 2: Identify error in code
@extend card; misses the dot, should be @extend .card;.
Final Answer:
Missing dot before card in @extend selector. -> Option A
Quick Check:
Class selectors need dot in @extend [OK]
Hint: Always include dot for class names in @extend [OK]
Common Mistakes:
Omitting dot before class name
Thinking @extend can't be used inside rules
Confusing property errors with selector errors
5. You want to create a .warning style that shares all styles from .alert but also adds background-color: yellow;. Which Sass code correctly does this?
hard
A. .warning { @extend alert; background-color: yellow; }
B. .warning { background-color: yellow; @extend .alert(); }
C. .warning { @extend .alert; background-color: yellow; }
D. .warning { @extend .alert background-color: yellow; }
Solution
Step 1: Understand @extend usage with additional styles
You can use @extend inside a selector and add other properties after it.
Step 2: Check each option
.warning { @extend .alert; background-color: yellow; } correctly uses @extend .alert; then adds background-color in the same block. Others have syntax errors: parentheses after selector, missing dot before alert, or missing semicolon.
Final Answer:
.warning { @extend .alert; background-color: yellow; } -> Option C
Quick Check:
@extend plus extra styles in same block [OK]
Hint: Put @extend first, then add extra styles in same block [OK]
Common Mistakes:
Adding parentheses after selector
Omitting dot before class name in @extend
Missing semicolon after @extend
Recommended
Ready to prove it?
Pass the test and this pattern moves unknownstrongwhile earning +1 Grip toward your certificate.