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 trialMeaghan Worcester
1,650 PointsLinking CSS stylesheet to index.html
This might be obvious BUT I can't identify why my stylesheet is not linking to html. Here's the code:
<link rel= "stylesheet" href= "css/normalize.css">
<link rel= "stylesheet" href= "css/main.css">
10 Answers
Meaghan Worcester
1,650 PointsGot it. Odd...had to recreate my workspace and copy and paste everything back in.
Derick Moncado
23,259 PointsYou're forgetting the 'type' attribute. Also you'll most likely want to get rid of those spaces after your rel and href attributes too, also check to see if your path is correct. Should look something like this:
<head>
<link rel="stylesheet" type="text/css" href="css/main.css">
</head>
Hope this helps :)
bothxp
16,510 PointsThat was my 1st through, but the extra whitespace shouldn't make a difference and you often see the type attribute left off.
Dagmar Wartenberg
8,504 PointsHave you checked if the path to the stylesheets is correct?
Grayson Sabin
6,911 Pointstry adding type="text/css
<link rel="stylesheet" type="text/css" href="css/normalize.css">
<link rel="stylesheet" type="text/css" href="css/main.css">
or check to make sure you have a folder named css and a file in it named main.css
Meaghan Worcester
1,650 PointsThanks everyone! Unfortunately, adding type="text/css" did not work. I am pretty sure that the path to the stylesheet is correct. I have a folder titled css with files named normalize.css and main.css. I'm stumped.
Grayson Sabin
6,911 PointsHow are you viewing your site? locally or on server?
also is your index.html in your root folder? same as where the css folder is?
Meaghan Worcester
1,650 PointsViewing locally. And yes, all in the same folder!
Dagmar Wartenberg
8,504 PointsCan you post the complete code in the head section of your index.html?
Meaghan Worcester
1,650 Points <head>
<meta charset= "utf-8">
<title> NAHS </title>
<link rel="stylesheet" type="text/css" href="css/normalize.css">
<link rel="stylesheet" type="text/css" href="css/main.css">
</head>
David Tonge
Courses Plus Student 45,640 PointsMust have been a bug. Glad you got everything to work.