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

Body Selector CSS

I don't know what I'm doing incorrect. Please help.

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

index.html

<!DOCTYPE html>
<html>
<head>
    <title>CSS Selectors</title>
    <link rel="stylesheet" href="cc1-main-styles.css" type="text/css" media="screen">
    <link rel="stylesheet" href="style.css" type="text/css" media="screen">
</head>
<body>
  <div class="container">
        <h1><em>Hello</em> World!</h1>
            <p>
                <em>Lorem ipsum dolor</em> sit amet, consectetur adipiscing elit. Nunc pulvinar consequat tortor, nec venenatis erat elementum scelerisque. Curabitur sit amet risus nisi. Aenean aliquet euismod augue at viverra. Ut varius arcu in lorem iaculis ullamcorper. Integer eu rutrum quam.
            </p>
    </div>
</body>
</html>

style.css

/* Complete the challenge by writing CSS below */

.container {
  background:lightblue;
}

7 Answers

First, if the Code Challenge has one, make sure you're in the style.css page.

Second, you should be able to select the whole body and change its color with:

body { background: lightblue; }

In this case, selecting the .container class happens to also select everything in the body, but if you added divs above or below, then only the .container div would be affected. They want the whole body regardless of divs. (These early lessons were really frustrating with not telling you what you were doing wrong. I feel your pain.)

Hopefully this helps!

Try this!

body {background-color:lightblue;} 

It wants you to use body instead of .container. :) Both work, but I think it pays more attention to syntax than results! Hope that helps!

Can you edit my codepen link and repost the link? That way I can see exactly what you mean. Thank you. :)

Oh gosh, anytime! We've all been there. :)

http://codepen.io/anon/pen/DljIK

This is what I've been doing and the background has changed successfully each time but it's incorrect according to the lesson. Sorry the original post didn't come out correct.

Oh snap. So obvious it hurts.

NOT .body {} body{}

Thank you both! Thanks for being so very patient with me Geneva.