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

Select the body of the page. Set its background color to lightblue.

The code i had put was {.body .style Background-color= lightblue;} i dont know why its not working can someone please help me!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!???????????

3 Answers

Have you linked your CSS file to your index.html or other file? If so have you done so correctly?

Make sure you do this, most commonly done so in the header of your page.

<html>
    <body>
        <header>
            <link rel="stylesheet" type="text/css" href="style.css">
        </header>
    </body>
</html>

Notice the <link> tag is self closing and requires no closing tag :) Next your CSS looks correct but I will format to ensure I am reading it correctly and that you are doing it correctly.

body {
    background-color: lightblue;
}

This is quite simple but feel free to ask if you don't understand something or need more help.

Happy coding!

Steven Parker
Steven Parker
243,656 Points

You have a few different issues here:

  • "body" is an element tag, so is used as-is in the selector (selectors starting with a period refer to a class)
  • the selector must come before the open brace
  • there should not be a reference to a style class
  • the property name is separated from the value with a colon (:) (not a =)