0
0
SASSmarkup

Mixin definition with @mixin in SASS - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is a @mixin in Sass?
A @mixin is a reusable block of CSS styles in Sass. It lets you write styles once and include them wherever needed, saving time and avoiding repetition.
Click to reveal answer
beginner
How do you define a mixin named button-style in Sass?
You write @mixin button-style { /* styles here */ }. Inside the curly braces, you put the CSS rules you want to reuse.
Click to reveal answer
beginner
How do you include a mixin in a CSS rule?
Use @include mixin-name; inside the CSS selector where you want the styles to appear.
Click to reveal answer
intermediate
Can mixins accept parameters? Why is this useful?
Yes, mixins can take parameters to customize styles. This makes them flexible, like a recipe where you can change ingredients to get different results.
Click to reveal answer
intermediate
What is the difference between a mixin and a placeholder selector in Sass?
Mixins can include CSS and accept parameters, and you include them with @include. Placeholders are like invisible selectors used with @extend and can't take parameters.
Click to reveal answer
What keyword do you use to define a mixin in Sass?
A@function
B@include
C@extend
D@mixin
How do you add a mixin's styles inside a CSS rule?
A@mixin mixin-name;
B@extend mixin-name;
C@include mixin-name;
D@use mixin-name;
Which of these is a benefit of using mixins?
AAutomatically minify CSS
BWrite CSS only once and reuse it
CReplace HTML tags
DCreate JavaScript functions
How do you define a mixin to accept a parameter named color?
A@mixin example($color) { ... }
B@include example(color) { ... }
C@mixin example { color: color; }
D@include example { color: color; }
Which Sass feature is best for reusable styles that need parameters?
AMixins
BFunctions
CVariables
DPlaceholder selectors
Explain what a mixin is in Sass and how it helps in writing CSS.
Think of a mixin like a reusable recipe for CSS styles.
You got /4 concepts.
    Describe how to define a mixin with parameters and how to use it in your styles.
    Parameters let you customize the mixin each time you use it.
    You got /3 concepts.