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

HTML Build a Simple Website Creating a Website Structure Working with Grids

The css files does not link for me

Hi, My both css files is not working and also i have put it into my project folder. I have put the following code:

<link rel="stylesheet" href="css/normalize.css" type="text/css" 
media="screen">
<link rel="stylesheet" href="css/grid.css" type="text/css" 
media="screen">

Please advice, thank you :)

8 Answers

Dave McFarland
STAFF
Dave McFarland
Treehouse Teacher

If the web page is in the SAME folder as the CSS files, you don't need to include a folder name, just the name of the CSS file. So, if your web page is in the same folder as the two css files, this code should work:

<link rel="stylesheet" href="normalize.css" type="text/css" media="screen">
<link rel="stylesheet" href="grid.css" type="text/css" media="screen">

You might want to review how file paths work. (how you link to another file like a CSS, JavaScript or another HTML page). This video is a good place to start (https://teamtreehouse.com/library/html/links/websites-part-1)

Dave McFarland
STAFF
Dave McFarland
Treehouse Teacher

Where are the two CSS files in relation to the web page? There should be a folder named css that's in the SAME folder as this web page. Then, inside the css folder you should have the two CSS files -- normalize.css and grid.css. Is that how the files are set up?

It was in the css folder but then i moved to the img folder where index.html is located because when it was in the css folder it was not working. I have now changed the coding to img/normalize.css or img/grid.css instead of css. But it still not working.

Also,Initially when i downloaded the normalise.css was in the img file , only the grid.css was in the css file.

John Breiner
John Breiner
6,918 Points

ok your index should be in the root folder for that directory. Then based on what you put the two css files should be in a folder labeled css. As far as images go since you brought that up you can put them into a folder labeled img, but you need to specify that in the path.

Okay thank you guys will try both of the methods.

Caesar Bell
Caesar Bell
24,829 Points

css/"css_file_name" is the path of your directory. So when you do that it will look for a folder called css and then the css file (i.e normalize.css) so if there is no folder with that name in the right directory then it wont work. So just make sure you enter the right path.

Thank you all for the answers, its working now :)