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

Code Challenge: adjacent sibling combinator doesn't work

Can't figure out what I'm doing wrong. The challenge says Use the Adjacent Sibling Combinator to select the p elements that immediately follow the h2. Set their background to lightblue.

I wrote the following:

h2 + p { background-color: #BDD4DE;}

and get this "Bummer" message:

Bummer! The Adjacent Combinator is +, try double checking your css selectors.

In addition to that, the page viewer to the right shows that only one of the paragraphs after the h2 heading were affected by the code (ie: changed to light-blue background).

Also, needless to say, I am writing this code in the style.css tab, not the index.html tab. Am I missing something or could this be a bug. I'm using Firefox but I also tried it in IE and still not working.

Thanks!

1 Answer

Hi Gil,

sounds like you're having the same problem I had with that code challenge. Try setting the background color to "lightblue" instead of using the hex-value.

see https://teamtreehouse.com/forum/stuck-in-css-foundations-code-challenge

Thanks Birk! That was exactly the problem! I had tried to use the text format for the color but had written 'light-blue' (with a hyphen). Once I typed 'lightblue' it worked!

Appreciate the help!

I find that a lot of people have this problem where they use a hex-value rather than a key word...The thing that amazes me most about that is, I have no idea where they get the value from!

Just copy/pasted from one of the lesson files. I definitely don't know the hex codes by heart!

Just copy/pasted from one of the lesson files.

The projects done in the videos are merely meant to be instructive not are not setup to allow you copy & paste from a video into a code challenge, and that's a good thing because you don't tend to learn much when you just copy and paste copy without fully understanding how it works.