0
0
SASSmarkup~5 mins

Avoiding selector bloat from @extend in SASS - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is selector bloat when using @extend in Sass?
Selector bloat happens when @extend causes many CSS selectors to combine, making the final CSS larger and harder to read.
Click to reveal answer
intermediate
How can you avoid selector bloat when using @extend?
Use @extend only with placeholder selectors (starting with %) and avoid extending complex selectors to keep CSS clean.
Click to reveal answer
beginner
What is a placeholder selector in Sass?
A placeholder selector starts with % and is used only for @extend. It does not output CSS on its own, helping avoid selector bloat.
Click to reveal answer
intermediate
Why should you avoid extending selectors with many classes or elements?
Because it creates long combined selectors in the output CSS, increasing file size and reducing readability.
Click to reveal answer
intermediate
What is a good alternative to @extend to avoid selector bloat?
Using mixins or utility classes can help reuse styles without creating complex combined selectors.
Click to reveal answer
What does @extend do in Sass?
AAdds JavaScript to CSS
BCopies styles from one selector to another
CDeletes unused CSS selectors
DCreates a new CSS file
Which selector type helps avoid selector bloat when using @extend?
AElement selectors (e.g., <code>div</code>)
BID selectors (e.g., <code>#header</code>)
CClass selectors (e.g., <code>.button</code>)
DPlaceholder selectors (e.g., <code>%placeholder</code>)
What is a downside of extending complex selectors with many classes?
AIt creates long combined selectors causing selector bloat
BIt reduces CSS file size
CIt makes CSS invalid
DIt disables styles
Which Sass feature can be used instead of @extend to avoid selector bloat?
AVariables
BNesting
CMixins
DFunctions
What happens if you extend a placeholder selector?
AThe styles are copied and selectors combined only where extended
BThe placeholder selector outputs CSS on its own
CNo CSS is generated
DAn error occurs
Explain what selector bloat is and how using placeholder selectors with @extend helps avoid it.
Think about how CSS selectors combine and how placeholders don't output CSS alone.
You got /4 concepts.
    Describe alternatives to @extend that help keep your CSS clean and avoid selector bloat.
    Consider ways to reuse styles without combining selectors.
    You got /4 concepts.