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 trialFurtuna Virgil
32,452 PointsThis is so confusing. I find it hard to link the css file to the html. This Mac version is so confusing
Can't link it. I don't understand were i should place those files and how should i specify the path.
12 Answers
Thas Eagans
Courses Plus Student 2,533 PointsOk lets say you have a root folder called 'project'. Inside project you have two folders: 'css', and 'images'.
You index.html file sits inside your root folder (projects). You plhave a stylesheet name styles.css inside your css folder (css).
Inside your index.html file you link to the stylesheet like so....
<!DOCTYPE html>
<html>
<body>
<head>
<title>Title to Page Here</title>
<!-- below we link to our styles.css file that sits inside the css folder -->
<link href="css/styles.css" rel="stylesheet" type="text/css">
</head>
Hope this helps.
</TREagans>
Furtuna Virgil
32,452 PointsIt got so complicated since he didn't explained for pc. Well this is what i came up with, and it's wrong of course. I created that file on desktop.
<link rel="stylesheet" type="text/css" href="css/style.css">
Where does that folder need to be so that the href would be " css/style.css" The main folder is sublime text 3, index.html in it, and subfolder css with style.css in it
Thas Eagans
Courses Plus Student 2,533 PointsIf your root folder is sublime text 3, and you have a folder inside it called css with styles.css inside it, then the code I posted above will still work.
you open the index.html and add the link element like I showed you above.
</TREagans>
Furtuna Virgil
32,452 Pointsyeah it's not working. so bad since i can't link the css i can't continuie with this course. This thing was the only problem i encountered in this entire course, just awesome. Thank you anyway.
Thas Eagans
Courses Plus Student 2,533 PointsYou could always embed the styles into the index.html page. Up top, inside the head section...
<!DOCTYPE html>
<html>
<body>
<head>
<title>Title to Page Here</title>
<style>
/* add your styles */
</style>
</head>
</TREagans>
Furtuna Virgil
32,452 Pointswow..i tried again as in the course and it worked...thank god.
Thas Eagans
Courses Plus Student 2,533 PointsGood luck!
</TREagans&rt;
Furtuna Virgil
32,452 Pointsyeah i know you could do that, but as a beginner you complicate too much without entering in the css file.
Furtuna Virgil
32,452 Pointsthank you for your time.
Thas Eagans
Courses Plus Student 2,533 PointsInitially I embed all my styles into the page i'm working on. Then once I finalize the page, I will then move those styles into an external style sheet. Makes production faster as you're not moving back and forth between 2 diff pages. Thats just my style of coding tho.
</TREagans>
Furtuna Virgil
32,452 PointsYeah, well i guess you practiced more than me so probably that's the reason. If i do the same thing i probably get more confused, or i don't know. It may be faster but now it's probably better for me if i learn with little steps. Thank you again.
Jamie Neal
706 PointsI had the same problem, if your .css file is in the same folder as your .html file then you link it like this: <link rel="stylesheet" href="style.css">. Drop the "ccs/" this worked for me as it was not clear on the video.