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 CSS Basics (2014) Getting Started with CSS Inline and Internal Styles

My background color doesn't change from white to orange. What did I do wrong.

This is my code <!DOCTYPE html> <html> <head> <title>Lake Tahoe</title> </head> <body style="background-color: orange;"> <header> <span>Journey through the Sierra Nevada Mountains</span> <h1>Lake Tahoe, California</h1> </header> <p> Lake Tahoe is one of the most breathtaking attractions located in California. It's home to a number of ski resorts, summer outdoor recreation, and tourist attractions. Snow and skiing are a significant part of the area's reputation. </p> <a href="#">Find out more</a> </body> </html>

LaToya Legemah
LaToya Legemah
12,600 Points

We need to see your css code, please.

Ezequiel Gonzalez
Ezequiel Gonzalez
1,358 Points

css "code" is not there... but anyways link reference for css style-sheet reference is missing on your html

in your external css stylesheet, (example.css) do,

body{background-color:orange;}

3 Answers

Steven Parker
Steven Parker
231,236 Points

It doesn't look like you've shared the code where you tried to set the color. Also your HTML has no <head> or <body> elements, but it has components that would normally be separated into these areas (title in the head, for example).

But anyway, coloring your background could be done with either a CSS rule or an inline style. Once you have your body element in your HTML, you could include a style with it like this:

<body style="background-color: orange">

Or, you could create a CSS rule in an internal style element or in an included stylesheet file:

body {
  background-color: orange;
}
Ezequiel Gonzalez
Ezequiel Gonzalez
1,358 Points
         <link rel="stylesheet" type="text/css" href="my.css">

So, then it is just matter to link your css file in the html file

Matthew Beiswenger
Matthew Beiswenger
6,814 Points

Make sure that you refresh the webpage after you click the preview button. I also couldn't figure out why my background color didn't turn orange because I had assumed that the preview button would also refresh the page for me.