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 How to Make a Website CSS: Cascading Style Sheets What is CSS?

What do you use as an element selector if you want the whole background to be one specific color?

I understand what you do if you want the footer or nav to be a certain color.

Footer{background-color: green; }
nav { background-color: orange;}

but what if I want to make the whole background-color one color what would be the element selector? Is this when using Div's comes in?

3 Answers

Kelly von Borstel
Kelly von Borstel
28,880 Points

I believe you use body element as selector if you want the entire background of page affected.

body {
    background-color: green;
}
Seth McCombs
Seth McCombs
16,767 Points

You can set the background to the body element

body { 
     background-color: red; 
}

or you can create divs, using a wrapper div is a very common (a div with the class "wrapper") to contain all other elements.

thanks!