0
0
SASSmarkup

Placeholder selectors with % in SASS - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is a placeholder selector in Sass?
A placeholder selector in Sass is a special selector that starts with %. It is not rendered directly in the CSS but can be extended by other selectors to share styles.
Click to reveal answer
beginner
How do you define a placeholder selector in Sass?
You define a placeholder selector by starting the selector name with %, for example: %button-style { color: blue; }.
Click to reveal answer
intermediate
What is the main benefit of using placeholder selectors with % in Sass?
They help avoid repeating CSS code by allowing multiple selectors to share the same styles without generating extra CSS for the placeholder itself.
Click to reveal answer
beginner
How do you use a placeholder selector in another selector?
You use the @extend directive to include the styles from a placeholder selector. For example: .btn {@extend %button-style;}.
Click to reveal answer
intermediate
What happens if you define a placeholder selector but never extend it?
No CSS is generated for that placeholder selector because it only outputs styles when extended by other selectors.
Click to reveal answer
What symbol starts a placeholder selector in Sass?
A%
B#
C.
D&
Which Sass directive is used to apply styles from a placeholder selector?
A@extend
B@include
C@mixin
D@import
If a placeholder selector is not extended, what CSS is generated?
AThe placeholder styles are output as a class selector
BAn error occurs
CNo CSS is generated
DCSS with the placeholder selector name
Which of these is a valid placeholder selector?
A.nav-item
B%nav-item
C#nav-item
D&nav-item
Why use placeholder selectors instead of regular classes?
ATo style HTML elements directly
BTo make styles inline
CTo add JavaScript behavior
DTo create reusable styles without extra CSS output
Explain how placeholder selectors with % work in Sass and why they are useful.
Think about sharing styles without extra CSS code.
You got /4 concepts.
    Describe the difference between a placeholder selector and a regular class selector in Sass.
    Focus on CSS output and reuse.
    You got /4 concepts.