0
0
SASSmarkup~10 mins

Nesting depth and best practices in SASS - Interactive Code Practice

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

Complete the code to nest the .button styles inside .container.

SASS
.container {
  [1] {
    color: blue;
  }
}
Drag options to blanks, or click blank then click option'
A.button
B#button
Cbutton
D&.button
Attempts:
3 left
💡 Hint
Common Mistakes
Using an ID selector (#button) instead of a class selector.
Forgetting the dot before the class name.
Using the element selector without a dot.
2fill in blank
medium

Complete the code to nest the :hover pseudo-class inside .link.

SASS
.link {
  [1] {
    text-decoration: underline;
  }
}
Drag options to blanks, or click blank then click option'
A:hover
B&:hover
C.hover
D#hover
Attempts:
3 left
💡 Hint
Common Mistakes
Writing :hover without &.
Using class or ID selectors instead of pseudo-classes.
3fill in blank
hard

Fix the error in the nested Sass code to correctly style li elements inside ul.menu.

SASS
ul.menu {
  [1] li {
    padding: 10px;
  }
}
Drag options to blanks, or click blank then click option'
A>
B&:hover
C&
D& >
Attempts:
3 left
💡 Hint
Common Mistakes
Using combinators like > incorrectly inside the selector.
Adding pseudo-classes when not needed.
4fill in blank
hard

Fill both blanks to create a nested Sass rule that styles p elements inside .card only when hovered.

SASS
.card {
  [1] {
    [2] {
      color: red;
    }
  }
}
Drag options to blanks, or click blank then click option'
Ap
B&:hover
C&
D:hover
Attempts:
3 left
💡 Hint
Common Mistakes
Using :hover without & which refers to the wrong selector.
Nesting :hover before the element selector.
5fill in blank
hard

Fill all three blanks to write a Sass nested rule that styles span inside .alert when span has class .active and is hovered.

SASS
.alert {
  [1] {
    [2] {
      [3] {
        font-weight: bold;
      }
    }
  }
}
Drag options to blanks, or click blank then click option'
Aspan
B&.active
C&:hover
D.active
Attempts:
3 left
💡 Hint
Common Mistakes
Using .active without &, which targets a child instead of the parent.
Placing :hover before .active.
Not nesting selectors in the correct order.