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

Rosemary Douglas
Rosemary Douglas
973 Points

Hi! I can't seem to link the CSS from my HTML document. Can anyone help?

Code:

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

6 Answers

The only thing I can think of is that your CSS files aren't in the location "css/filename.css". Did you move them over from the root directory to the folder "css/.."?

Rosemary Douglas
Rosemary Douglas
973 Points

Yes the files are in the right place. I double checked with a previous workspace and the code is the same and the files are set up in the same way and this works. I could continue using the previous workspace I'm just confused as to why this new one doesn't work.

Check for errors by validating the CSS and HTML at the w3.org validation site. https://jigsaw.w3.org/css-validator/#validate_by_input http://validator.w3.org/#validate_by_input

Eric Anderson
Eric Anderson
694 Points

I am having the same issue with both CSS files in this course. I have triple checked my code and it is identical to the code in the video. As well my files names and order are the same as in the video as well.

I also had my friend look over it, who is a senior web developer, and he cannot find the issue.

Rosemary Douglas
Rosemary Douglas
973 Points

Ok good to know! I was beginning to doubt myself haha. Maybe it is a bug within workspaces.

Same problem...

Rosemary Douglas
Rosemary Douglas
973 Points

Do you have an older workspace you can use? I find when I launch a workspace I created in 2014 it links the CSS just fine.

Christina Dine
Christina Dine
474 Points

I'm having the same problem. That's quite frustrating. I wonder if I throw it in brackets if it would be the same?

Christina Dine
Christina Dine
474 Points

Okay, so I talked to my friend! Here's the deal. He took a look at my code,and thought that maybe my html file wasnt realizing my css was text so he had me try this:

on my CSS I put: /* CSS Document*/

on my HTML I put: < link rel="stylesheet" type="text/css" href="css/main.css" > ((Minus the spaces on the <>

I'm not sure if the css part on my document made the difference, but I did as he said and it worked.

Rosemary Douglas
Rosemary Douglas
973 Points

Thanks for the suggestion. I gave it a shot but no luck : (

Rishabh Mittal
Rishabh Mittal
260 Points

thanks christina, your friend is a genius. I was also having the same problem, and your above solution actually worked.. Thanks a ton for sharing!