0
0
SASSmarkup~10 mins

BEM naming with SASS nesting - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to define a BEM block named button with a nested element __icon using SASS nesting.

SASS
.button {
  color: blue;
  &[1] {
    margin-left: 0.5rem;
  }
}
Drag options to blanks, or click blank then click option'
A__icon
B-icon
C_icon
D--icon
Attempts:
3 left
💡 Hint
Common Mistakes
Using single underscore or hyphen instead of double underscore for elements.
Not using the ampersand & for nesting.
2fill in blank
medium

Complete the code to add a BEM modifier --active to the button block using SASS nesting.

SASS
.button {
  background: gray;
  &[1] {
    background: green;
  }
}
Drag options to blanks, or click blank then click option'
A--active
B_active
C-active
D__active
Attempts:
3 left
💡 Hint
Common Mistakes
Using underscores or single hyphens instead of double hyphens for modifiers.
Forgetting the ampersand & for nesting.
3fill in blank
hard

Fix the error in the code to correctly nest the __title element inside the card block using SASS nesting.

SASS
.card {
  padding: 1rem;
  &[1] {
    font-weight: bold;
  }
}
Drag options to blanks, or click blank then click option'
A_title
B__title
C--title
D-title
Attempts:
3 left
💡 Hint
Common Mistakes
Using single underscore or hyphen instead of double underscore for elements.
Not using the ampersand &.
4fill in blank
hard

Fill both blanks to create a BEM block nav with an element __item and a modifier --active on the element using SASS nesting.

SASS
.nav {
  &[1] {
    color: black;
    &[2] {
      color: red;
    }
  }
}
Drag options to blanks, or click blank then click option'
A__item
B--active
C-active
D__active
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing underscores and hyphens incorrectly.
Not nesting modifiers inside elements properly.
5fill in blank
hard

Fill all three blanks to create a BEM block form with an element __input, a modifier --error on the element, and a nested element __label inside the block using SASS nesting.

SASS
.form {
  &[1] {
    border: 1px solid gray;
    &[2] {
      border-color: red;
    }
  }
  &[3] {
    font-weight: bold;
  }
}
Drag options to blanks, or click blank then click option'
A__input
B--error
C__label
D-error
Attempts:
3 left
💡 Hint
Common Mistakes
Using single underscores or hyphens incorrectly.
Not nesting modifiers inside elements properly.