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


Matt Bell
Matt Bell
197 Points

how to set how big the background color is

Hey so i want to make my background color like only half the page so i can have one color half the page and the other white this is the code i have

body {

background-color: #4686a0;

really not sure what to do next can anyone help


Hi Matt,

you can't really have two colours as your background unless you want it to be a gradient.( check out css gradients if that is what you are looking to do.)You can do things like have a DIV that takes up half the page have a different background than your page background, for example.

1 Answer

The background-color property only sets the color of the elements that you're styling. If you want to have 2 colors you have to create a second element that has a different background-color.

Example 1: http://codepen.io/anon/pen/xGYJEa

Example 2: http://codepen.io/anon/pen/QbQBGd

Matt Bell
Matt Bell
197 Points

Wow thanks that really has helped and made sense to me now thanks so much !

No worries, glad I could help!