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

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

I'm having trouble getting my background color to change to orange when implemementing the CSS main.css code

My background color is not changing when I add the CSS.main to my html file. I have checked my syntax in my html and css.main file and they are correct. Was anyone else having a problem getting theirs to work?

Thanks.

Bryan

Konrad Pilch
Konrad Pilch
2,435 Points

Well, theres probably an error in your syntax. Can you paste your code please? We can't help you most of the times without seeing the code, as usually its the code.

Yongshuo Wang
Yongshuo Wang
5,500 Points

What is the CSS file's name you have ? CSS file should be something like main.css instead of CSS.main.

Hope this can help you.

IN my HTML file:

<head> <meta charset="utf-8"> <title>Bryan Flanigan | Designer</title> <link rel="stylesheet" href="css/normalize.css"> <link rel="stylesheet" href="css/main.css"> </head>

In my main.css file:

body { background-color: orange; }

Kody Kendall
Kody Kendall
2,473 Points

Hi Bryan. This could be because you already have a background changing style element in your HTML file. Since it is a cascading document, having this background element after your "main.css" syntax would override any changes that are in the "main.css" file. Double check to make sure you don't have any background-color styling in your HTML that comes after your link to main.css

4 Answers

Jennifer Nordell
seal-mask
STAFF
.a{fill-rule:evenodd;}techdegree
Jennifer Nordell
Treehouse Teacher

Well, here you've listed the files as having two different file names. First you say "CSS.main" and then "css.main". Note that file names in links are case-sensitive. But that being said, css files should end in ".css". Your file name should be main.css... not css.main.

Jennifer Nordell
seal-mask
STAFF
.a{fill-rule:evenodd;}techdegree
Jennifer Nordell
Treehouse Teacher

Are you absolutely positive that your file structure is set up correctly? Because you've listed three separate file names here for the CSS sheet. Make sure over in your file structure that "main.css" is actually named "main.css" and not "MAIN.css" or "css.main" or anything else. Also make sure that your css folder is named "css" and not "CSS" or "Css". Capitalization matters. I say this because so far your code looks fine. Also, make sure you save the file and refresh the page.

Jennifer you're awesome. My main CSS file folder was capitalized. I switched it to lower case and it worked perfectly. I needed a fresh set of eyes. Thanks to everyone for their help. I'm new at this and am still getting the syntax down it appears. Thanks again.

Olga Mendenhall
Olga Mendenhall
8,809 Points

Bryan, I've just got the same problem! :D)) Thanks for raising that question! Thank you, so much Jennifer!!! :)*