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 trialRosemary Douglas
973 PointsHi! 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
David Klaphaak
12,924 PointsThe 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
973 PointsYes 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.
David Klaphaak
12,924 PointsCheck 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
694 PointsI 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
973 PointsOk good to know! I was beginning to doubt myself haha. Maybe it is a bug within workspaces.
kvano
942 PointsSame problem...
Rosemary Douglas
973 PointsDo 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
474 PointsI'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
474 PointsOkay, 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
973 PointsThanks for the suggestion. I gave it a shot but no luck : (
Rishabh Mittal
260 Pointsthanks christina, your friend is a genius. I was also having the same problem, and your above solution actually worked.. Thanks a ton for sharing!