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

Robyn Goodwin
PLUS
Robyn Goodwin
Courses Plus Student 10,009 Points

Sass Code Challenge - challenging me!

I'm back from two weeks off and cannot figure out what I've done wrong. I'm sure it's basic but help please.

Set the width of the class .inner_sidebar to be half that of the sidebar_width variable.

My answer:

`/* Write your SCSS code below. */ $lime: #090; $sidebar_width: 100px;

body { p { a { color: $lime; } div .inner_sidebar { width: $sidebar_width/2; } } } ` **edited to remove .0 after 2

Tricia Martin
Tricia Martin
19,604 Points

I think you're making it more complicated than they're looking for. You don't need the nested styles, just an 'a' selector and the .inner_sidebar selector. The code I posted before definitely passes.

3 Answers

Tricia Martin
Tricia Martin
19,604 Points

Maybe take off the ".0" so it is just 2.

Here is what I used to pass:

/* Write your SCSS code below. */
$lime: #090;
$sidebar_width: 100px;

a {
  color: $lime;
}

.inner_sidebar {
  width: $sidebar_width / 2;
}
Robyn Goodwin
Robyn Goodwin
Courses Plus Student 10,009 Points

Oops meant to erase that. It was another attempt to make it work after the 2 all alone didn't work. Still stuck. Grrr. Thanks though.

Robyn Goodwin
Robyn Goodwin
Courses Plus Student 10,009 Points

Phew! Thank you Tricia! I had too much code. By removing the body element and stripping it down to the code you suggested passed the challenge.

I guess it's important not to overthink these challenges.

Hi Robyn,

Take a look at Tricia's code and compare with your own because the code has some significant differences beyond removing the ".0"

With your code you have done some nesting not requested in the challenge.

the main reason your code won't pass is that you have div .inner_sidebar nested inside the p block. this creates a final compiled selector of body p div .inner-sidebar which doesn't match the html structure.

I would recommend that you only write code that is specifically requested in the challenge.

I hadn't seen your second comment yet when I posted. I'll leave it in case you're interested in why it doesn't work.

Tricia Martin
Tricia Martin
19,604 Points

Glad you got it to work!

Tricia Martin
Tricia Martin
19,604 Points

Thanks Jason Anello for explaining it better than I could! I'm so bad at explaining things.

Robyn Goodwin
Robyn Goodwin
Courses Plus Student 10,009 Points

Jason, I appreciate your help. It's good to have it explained in a different way. I had already removed the .0 but was still having problems. Your comment about adding in additional info was spot on. Thank you.