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 How to Make a Website CSS: Cascading Style Sheets Use ID Selectors

Main.css will not load . .

This is what's in index.html:

<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>Jim Strickland | Designer</title> <link rel="stylesheet" href="css/normalize.css"> <link rel="stylesheet" href="css/main.css"> </head>

This is what's in main.css:

a { text-decoration: none; }

When I run index.html main.css has no effect? Could anyone offer a suggestion?

8 Answers

Make sure your file path is correct. Is "css/main.css" correct? Did you place the main.css file in a folder titled "css"? If not changed the file path to "main.css".

Also, check so you have saved the file after writing new code! :)

Niclas Valentiner
Niclas Valentiner
8,947 Points

Remember to add the type to your links. type="text/css"

I think Preston's got it right. Make sure "main.css" is actually in your "css" folder. You can double check this by changing

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

to

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

If it works, I bet you didn't move your "main.css" into the "css" folder.

Also, one thing I always forget to do is to save my files. If you're using Treehouse's workspace for writing this, make sure there isn't a colored dot after the filename on the top tab. ...now I see that erdrag already mentioned this!

Another question: do you have this stuff in your

<head></head>

section?

Steve N. Peralta R.
Steve N. Peralta R.
31,097 Points

ok, I'll notice that you've added here the Doctype too, and I guess thats the code you had on your index.html, right?. The question is: "Did U write that code into the HEAD tag?" I'm pretty sure u don't :P

Steve N. Peralta R.
Steve N. Peralta R.
31,097 Points
 <!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>Jim Strickland | Designer</title>
    <link rel="stylesheet" href="css/normalize.css">
    <link rel="stylesheet" href="css/main.css">
</head>

<body>
<!-- try it -->
</body>
</html>

However if u put the main.css on css folder it's ok, remember that the index must be on the root path. Try it locally too

main.css was saved, main.css is located in the css folder. I coded this: <link rel="stylesheet" href="css/main2.css"> for the purpose of troubleshooting.

main2.css doesn't really exist, I just made up the filename and I get no error because of this. That tells me that HTML isn't executing that line of code. This has me baffled. I'm at the end of my troubleshooting ideas. Any other conclusions?

Sorry you're having problems, James. Can I ask you this? What are you expecting this rule to do for you? Just to remove the underline from all

<a href="something">

anchor elements, right?

Right. Remove underlines from anchor elements.

try it with a:link?