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

Background color not changing

The background color is not changing when I add below code in main.css file

body { background-color: orange; }

Code in html file which is linked to css file below:

<link rel="stylesheet" href="css/normalize.css"> <link rel="stylesheet" href="css/main.css">

Any help would be appreciated Thanks

Hey Anil

<link rel="stylesheet"  type="text/css"  href="">  // try to insert type also if still u get error let me know

Can you paste your full code to http://codepen.io and save it, then send the link here, so we can see the full thing. thanks :)

also, you might want to add some markdown next time with your questions :) using the instructions below.

Wrap your code with 3 backticks (```) on the line before and after. If you specify the language after the first set of backticks, that'll help us with syntax highlighting.

      ```html
      <p>This is code!</p>
      ```

hi Ashish

This is exactly how I have below but still no change in background color

<link rel="stylesheet" href="css/normalize.css"> <link rel="stylesheet" href="css/main.css">

Vince, I have never seen that site before and dont know how to use it im afraid

Codepen allows you to save and preview code, similiar to the workspace feature on treehouse. But with codepen you can save your code on codepen and send the link to other people. Search up some videos in future, but for now, maybe just paste your entire html and css code so we can take a better look.

2 Answers

Steven Parker
Steven Parker
243,318 Points

:point_right: Your body CSS rule is good.

So I would check to be sure the CSS file is being linked properly from the HTML. Check the location - is it really in a subfolder named "css"? Also check the HTML to see if some other element is covering the entire area and obscuring the background.

Codepen is a neat tool, but when working on things here an even better tool is the Treehouse Workspace, which you may already be using in the course. You can share your workspace by making a snapshot and providing the link here.

Your right Steven I had just figured it out that the the main.css file was not in the CSS folder.

Ok I didnt know you can take a snapshot of workspace but thanks for the advice.

Thanks for your help.

True good point Steven!

Its working now.

Thanks for the codepen tool and help.

cheers