Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

CSS How to Make a Website CSS: Cascading Style Sheets Use ID Selectors

I cannot get the background color to change on my main.css file using safari or chrome.

<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>MaddSketcher Design | Let's Design Fun!</title> <link rel="stylesheet" href="css/normalize.css"> <link rel="stylesheet" href="css/main.css"> </head> <body> <header> <a href="index.html"> <h1> MaddSketcher Design</h1> <h2> Lisa Dorn</h2> </a> <nav> <ul> <li><a href="index.html">Portfolio</a></li> <li><a href="about.html">About</a></li> <li><a href="contact.html">Contact</a></li> </ul> </nav> </header>
<section> <ul> <li> <a href="img/check.png"> <img src="img/check.png" alt=""> </a> </li> <li> <a href="img/logo.png"> <img src="img/logo.png" alt=""> </a> </li> <li> <a href="img/tag.png"> <img src="img/tag.png" alt=""> </a> </li> <li> <a href="img/rule.png"> <img src="img/rule.png" alt=""> </a> </li> <li> <a href="img/fun.png"> <img src="img/fun.png" alt=""> </a> </li>
</ul> </section> <footer> <a href="https://www.behance.net/LisaDorn"><img src="img/portfolio.png" alt="portfolio icon"></a> <a href="https://www.linkedin.com/pub/Lisa-Dorn/a4/128/886"><img src="img/resume.png" alt="resume icon"></a> <a href="img/email.png"> <img src="img/email.png" alt=""></a> <p>maddsketcher@mac.com</p> <p>© 2015 Lisa Dorn.</p> </footer> </body> </html>

Here's the main.css code

body{ background-color: orange; }

The main.css file is in the CSS folder.

8 Answers

I don't see any Body tags in your html

I still don't understand. From what I see, my code looks just like the code on video. Can you please elaborate a little? Thanks for your help!

Your CSS is targeting an html tag that doesn't exist in your markup.

Try adding a body opening tag right before header and closing the body tag after your footer

Ah...okay...thanks. I will check that out.

Andrew - it's really strange, coz the file coding on my workspace has this body tag, but it doesn't show up on the copy and paste I posted of my coding.

<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>MaddSketcher Design | Let's Design Fun!</title> <link rel="stylesheet" href="css/normalize.css"> <link rel="stylesheet" href="css/main.css"> </head> <body> <header> <a href="index.html"> <h1> MaddSketcher Design</h1> <h2> Lisa Dorn</h2> </a> <nav> <ul> <li><a href="index.html">Portfolio</a></li> <li><a href="about.html">About</a></li> <li><a href="contact.html">Contact</a></li> </ul> </nav> </header>
<section> <ul> <li> <a href="img/check.png"> <img src="img/check.png" alt=""> </a> </li> <li> <a href="img/logo.png"> <img src="img/logo.png" alt=""> </a> </li> <li> <a href="img/tag.png"> <img src="img/tag.png" alt=""> </a> </li> <li> <a href="img/rule.png"> <img src="img/rule.png" alt=""> </a> </li> <li> <a href="img/fun.png"> <img src="img/fun.png" alt=""> </a> </li>
</ul> </section> <footer> <a href="https://www.behance.net/LisaDorn"><img src="img/portfolio.png" alt="portfolio icon"></a> <a href="https://www.linkedin.com/pub/Lisa-Dorn/a4/128/886"><img src="img/resume.png" alt="resume icon"></a> <a href="img/email.png"> <img src="img/email.png" alt=""></a> <p>maddsketcher@mac.com</p> <p>© 2015 Lisa Dorn.</p> </footer> </body> </html>

Weird, it shows the body tag up until I post it.

file:///Users/Lisomania/Desktop/lisadorncode.jpg

Can you post the picture of your CSS file since we are working on background-colour in CSS.