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

Question on Part 2 of the Attribute Selector Code Challenge

Instructions for Part 2 of the code challenge:

Use the Adjacent Sibling Combinator to select the <p> elements that immediately follow the h2. Set their background to lightblue.

My code is

    div > a {
      color:green;
      font-weight:bold;
    }

      h2 + p {
        background-color:#3F5765;
    }

I think my background color is wrong its dark blue not light blue.

9 Answers

background-color: lightblue;

That will work just fine :)

Thankyou now I can continue :)

yeah -- other than

#000 /* and */ #fff

you pretty much have to use the color names

jake & Alexander - Each color keyword has a very specific hex code that goes with it. It's usually best to use the color keyword specified in the instructions of the code challenge.

If you are really curious can check out the list of color keywords that are defined in the offical W3C CSS Spec.

jake - According to that list Light Blue is actually #ADD8E6 not #3F5765, this helps explain why you couldn't pass that code challenge.

Jack -

Here on the Treehouse forum we like to take more of teach a man to fish approach by offering hints about where to a user can look in their code or providing additional explanation of the instructions.

Anyone can cut and paste some code, but you aren't doing other users any favors, please they won't learn anything that way. Remember the goal of this forum is understanding not getting past a code challenge.

Thanks @james!

I have ONLY used the color keywords for testing (generally because I found the commonly-used colors in HTML reference charts and books to be U-G-L-Y)... and since Photoshop/Fireworks give you the hex code, I never really took the time to do anything with that.

Good to know. Hopefully I'll never have to use it ;)

Alexander - Personally I only use color keywords for testing as well. On production sites, I'm pretty sure it's a best practice to use hex codes instead of color keywords.

is that stuff a relic from the days of 256 web colors?

Alexander -

is that stuff a relic from the days of 256 web colors?

I don't exactly which stuff you are referring to.

The extended color keyword list actually comes from the X Windows Project. You can read more about the history of color usage on the web over on the web colors Wikipedia page.