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

CSS How to Make a Website Customizing Colors and Fonts Use Color in CSS

Yehudah Rice
Yehudah Rice
6,913 Points

Css Linking To HTML

My main.css doesn't link to my html

Dave McFarland
Dave McFarland
Treehouse Teacher

Can you show the code you are using to link to the stylesheet?

Yehudah Rice
Yehudah Rice
6,913 Points

Even using normalize doesn't work, this is the code, it is linked to a normalize.css file in my css folder <html>

<head>

    <meta charset="utf-8">

    <title>YehudahRice | Designer</title>

    <link rel="stylesheet" href="css/normalize.css">   

</head>

5 Answers

Itsa Snake
Itsa Snake
3,852 Points

Your HTML should link to your css

Within your HEAD in the HTML, you need to load the CSS path properly.

If your css file is within a css folder, as below:

<link rel="stylesheet" href="css/main.css">

If your css file within the same path, as below:

<link rel="stylesheet" href="main.css">
Dave McFarland
STAFF
Dave McFarland
Treehouse Teacher

Look at where your files are in relation to each other -- like JJ Jar suggested. Where is the HTML page in relation to the CSS files? For example, if you have two folders -- one with your CSS files and another containing your HTML file -- and those two folders are both grouped together in the same folder on your computer, then the path to get to the CSS file would be something like "Go UP and OUT of the HTML folder, then INTO the CSS folder and select the CSS file".

The way you would write that would be

<link rel="stylesheet" href="../css/main.css"

The ../ means "go out of the current folder up one level. To go up two levels (exit a folder then exit another folder) you'd write ../../

Itsa Snake
Itsa Snake
3,852 Points

Check the path of your css files. Are they definitely in the css folder? if not, remove "css/" in the file path

Yehudah Rice
Yehudah Rice
6,913 Points

I am not sure what the probleme was, but I just took normalize and main out of the CSS folder and removed the part of code with that folder so it looks like: <link rel="stylesheet" href="normalize.css"> , and it works thank you guys so much

guarlonmirka
guarlonmirka
10,192 Points

Hi, I am having the same issue, my style.css is in the CSS folder. I have applied the following code in Index.html file <link rel="stylesheet" href="style.css"> but it is not working. Please not that I have only 1 folder named CSS. Thanks