0
0
SASSmarkup~5 mins

Combining & with pseudo-classes in SASS - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What does the & symbol represent in Sass?
The & symbol represents the parent selector. It lets you refer to the current selector inside nested rules.
Click to reveal answer
beginner
How do you combine <code>&</code> with a pseudo-class like <code>:hover</code> in Sass?
You write &:hover inside a nested block. It means "apply styles when the parent element is hovered."
Click to reveal answer
beginner
Example: What CSS does this Sass produce?
.btn {
  color: blue;
  &:hover {
    color: red;
  }
}
It produces:
.btn {
  color: blue;
}
.btn:hover {
  color: red;
}
This means the button is blue normally and red when hovered.
Click to reveal answer
intermediate
Can you combine & with multiple pseudo-classes? For example, &:focus:hover?
Yes! You can combine multiple pseudo-classes after &. For example, &:focus:hover targets the parent element when it is both focused and hovered.
Click to reveal answer
beginner
Why is using & with pseudo-classes helpful in Sass?
It keeps your styles organized and readable by nesting related states inside the main selector. It avoids repeating the full selector and reduces errors.
Click to reveal answer
In Sass, what does &:hover mean inside a nested block?
AApply styles only on click
BApply styles to all child elements
CApply styles when the parent element is hovered
DApply styles to sibling elements
What CSS does this Sass produce?
.card {
  background: white;
  &:focus {
    background: gray;
  }
}
A.card { background: white; } .card:focus { background: gray; }
B.card { background: white; } .focus { background: gray; }
C.card:focus { background: white; } .card { background: gray; }
D.card { background: white; background: gray; }
Which of these is a valid way to combine & with pseudo-classes in Sass?
A&hover-active
B&hover:active
C&:hover-active
D&:hover:active
Why use & in Sass instead of writing the full selector again?
ATo make code longer
BTo keep code DRY and organized
CTo confuse browsers
DTo disable styles
What happens if you write &:not(:hover) in Sass?
AStyles apply when the parent is NOT hovered
BStyles apply only on hover
CStyles apply to child elements
DIt causes an error
Explain how the & symbol works when combined with pseudo-classes in Sass.
Think about how Sass helps write shorter, clearer CSS.
You got /4 concepts.
    Describe a real-life example where combining & with pseudo-classes in Sass improves your CSS code.
    Imagine styling a button with different states.
    You got /4 concepts.