Recall & Review
beginner
What does the
& symbol represent in Sass when used with BEM naming?The
& symbol represents the parent selector. It helps to write nested styles by referring back to the current block or element name in BEM.Click to reveal answer
beginner
How do you write a BEM modifier using
& in Sass?You append the modifier to the parent selector using
&--modifier. For example, .button { &--primary { color: blue; } } styles .button--primary.Click to reveal answer
beginner
Why is combining
& with BEM naming helpful in Sass?It keeps your CSS organized and avoids repeating the full class name. It also makes your code easier to read and maintain by showing the relationship between blocks, elements, and modifiers.Click to reveal answer
beginner
Write a Sass snippet using
& to style a BEM element .card__title inside .card..card {
&__title {
font-weight: bold;
}
} This compiles to .card__title { font-weight: bold; }.Click to reveal answer
beginner
How would you style a BEM modifier
.nav__item--active using & inside .nav__item?.nav__item {
&--active {
color: red;
}
} This targets .nav__item--active with red text color.Click to reveal answer
In Sass, what does
&__element inside .block represent?✗ Incorrect
&__element inside .block creates .block__element, a BEM element class.
How do you write a BEM modifier
.button--large using & inside .button in Sass?✗ Incorrect
The modifier uses double dashes: &--large inside .button becomes .button--large.
What is the main benefit of using
& with BEM in Sass?✗ Incorrect
& helps write nested CSS rules without repeating full class names, making code cleaner.
Which Sass code creates the class
.menu__link--active?✗ Incorrect
Using &--active inside .menu__link creates .menu__link--active.
If you want to style
.header__nav inside .header using Sass and &, which is correct?✗ Incorrect
&__nav inside .header creates .header__nav, the BEM element.
Explain how the
& symbol helps write BEM-style CSS in Sass.Think about how nesting works in Sass and how BEM class names are structured.
You got /4 concepts.
Write a Sass example using
& to style a block .card, an element .card__header, and a modifier .card--featured.Remember BEM uses double underscores for elements and double dashes for modifiers.
You got /3 concepts.