Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

CSS Sass Basics Improve Your Workflow with Sass Write Nested Selectors

Abinet Kenore
Abinet Kenore
10,082 Points

Use the & symbol to create the selector .icn-warning. Set the color of .icn-warning to red.

I tried all the posted Answers to chech after I tried my answers. Those Answer's are not working for me. Here is my trial

.banner { padding: 1em; background-color: lightgrey;

.button { font-size: 1.5em; }

.icn { font-size: 1.25em;

&-success {
 color: green;

} &-icn-warning { color: red; }

}

style.scss
.banner {
  padding: 1em;
  background-color: lightgrey;

  .button {
    font-size: 1.5em;
  }

  .icn {
    font-size: 1.25em;

    &-success {
     color: green;
   }
   &-success-warning {
    color: red;}
  }

}

1 Answer

Hey, the below code works fine for this. As you can see you don't need to declare .icn again as you already have it so you just do what you did with the .icn-success class and list it below, you can do this as much as you want to keep the code clean.

.banner {
  padding: 1em;
  background-color: lightgrey;
  .button {
    font-size: 1.5em;
  }
}

.icn {
   font-size: 1.25em;
   &-success {
      color: green;
   }
   &-warning {
      color: red;
   }
}