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

Trevor Wood
Trevor Wood
17,828 Points

A quick question about CSS

Hey guys,

So i'm on Styling Content/Font and Colors .

I'm having trouble with the style.css file.

For it to apply it's effects on my index.html file I have to save it in a new folder every time. If i put it in the same old folder, then it takes its former appearance.

This can't be right. Can anybody help me out?

3 Answers

where are you storing your css stylesheet?? when i build websites what i normally do is i will have the main folder for all files so something like this.

main_folder (inside the main_folder) i would have these folders - "css" and "img"

for my html template i would have this:

<!doctype HTML>
<html>
<head>
<title>Title of website here</title>
<link rel="stylesheet" href="css/style.css" type="text/css" />
</head>

<body>
</body>
</html>

not sure if this is what you do also but for me it makes sure that everything is organised, as i can see you are linking to your desktop and stuff which i don't find is good practice. Hope this is understandable, if not let me know i can try explain a little better.

Guil Hernandez
Guil Hernandez
Treehouse Teacher

Thanks, Brian Pirouet! Trevor Wood – let us know if this works for you. :)

Trevor Wood
Trevor Wood
17,828 Points

Thanks Brian!

I moved all the files into one folder and cleaned up the code so it doesn't have desktop in it.

It works better but it doesn't apply the changes right away like the index.html file does. ( by not right away, I mean if I come back to it in a few minutes or if I restart the computer it applies the changes. ) Is this normal?

Guil Hernandez
STAFF
Guil Hernandez
Treehouse Teacher

Hi Trevor Wood,

How are you linking the style sheet? Can you please post an example of that?

Thanks!

Trevor Wood
Trevor Wood
17,828 Points

Here's the link code I'm currently using. I had linked it differently but every time I want to save it I have to change the directory otherwise it won't go into affect.

link rel="stylesheet" href="/Users/Trevor/Desktop/124/style.css" type="text/css" media="screen"

I removed the <> brackets.

Thanks!