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

Code written in main.css not showing up in preview.

I posted an earlier question about my main.css not linking under my normalize.css. I have checked, re-written, and started over multiple times to no avail. I have saved and refreshed my preview, and nothing changes.Here are my codes. Also, I have main.css inside the css folder.

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Robert Weber</title>
<link rel="stylesheet" href="css/normalize.css">
<link rel="stylesheet" href="css/main.css">
</head>

Here is my main.css code

body {
  background-color: orange;
}

And here is my snapshot https://w.trhou.se/hxx6q5ttov

2 Answers

Hi Robert,

If all of the files are in the correct directories, perhaps this issue is because the link statement is missing the 'type' attribute to tell the DOM what type of document to expect. The code may be fixed by replacing the current link statement with the revised statements below:

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

Hope this works!

Thanks Chris, but that still didn't work. I don't know what else to do. Can't figure out why it is not linking.

It just hit me that im linking to "css/normalize.css", but my folder is actually CSS. All caps. I changed the css to CSS and all is good. Thank you.

Steven Parker
Steven Parker
243,656 Points

Check your file locations.

For an issue involving mutliple files, it would be more useful to use the snapshot function in the workspace and provide the link to it.

But I would guess it may be where the files are located. Be sure your main.css file is located in a folder named css, and that folder is itself in the same folder as your HTML file.

Thanks Steven, yes both normalize.css and main.css are located inside of the CSS folder. I have tried deleting the main.css file and starting over completely to no avail.