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

General Discussion

can't get my .css document file to link to .html document file?

I'm using sublime text/editor (free version). I don't know I saved my new editor version file as a .css file it shows the file type as such but, doesn't seem to link with my .html document? I still think the .css file should be able to link to it... <link rel="stylesheet" href="css/style.css"> I'm using the right attribute I believe from what I learned.

Hi Joseph,

Could you show the code in the html file?

Jeff

!doctype html> <html lang"en-UK"> <head> <meta charset="utf-8"> <title>New Page©</title> <link rel="stylesheet" href"css/style.css"> </head> <div id="wrapper"></div> <body> <header> <h1>America's best Craft Beer!</h1> </header> <nav> <fieldset> <ul> <li>first child.</li> <li>second child.</li> <li>third child.</li> <li>last child.</li> </ul> </fieldset> </nav> <table style="width:300px"> <fieldset> <tr> <th>Sam Adams©</th> <th>New Belgium©</th> </tr> <tr> <td>Boston Lager</td> <td>Fat tire Amber ale</td> <td>Oktoberfest</td> </tr> <tr> <td>Eve</td> <td>Jackson</td> <td>94</td> </tr> </fieldset> </table> <form class"e-form"> <input type="email"name="email"> <input type="submit"name="submit"> </form> <section></section> <footer></footer> </body> </html>

8 Answers

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

according to your link you have a file named style.css thats located in a folder called css. Is that correct?

I've already used that same code with attribute. I even erased my code & copied yours but, still doesn't link???

Look at the "folder structure" my friend. Could it be something like .... link rel="stylesheet" href="../css/styles.css" add <> as its not letting me add code in this text area.

the folder says its a css type which sounds correct wouldn't you say? or should it be something else?

no I've got that code already nested that's why I'm puzzled...I mean unless somebody knows something that wouldn't allow it to reference my saved html file??? with <link rel"stylesheet" href"css/style.css">

Make sure your checking to see everything is in lowercase. Also make sure the spelling is correct. I sometimes put styles/style and in my html document its different. Check the HTML link="stylesheet" href="css/style.css" <---- (file name is correct)

Also one more note... Have you got the link rel="stylesheet" href="styles.css" in the correct place in the document ? It should be in the header tags and also it does depend what order you put other files in to take effect. send us a link thru codepen and i will take a look for ya. :) (TRY MY BEST)

Hey Stone Preston ,

You stated to Joesph according to your link you have a file named style.css thats located in a folder called css. Is that correct?. What link are you referring to? I don't see any link in his post.

Jeff

Hey Joseph,

If you look to the bottom right of the text box you will see something that says Markdown Cheetsheet. If you don't understand that maybe this will make sense: How to display code at Treehouse

file:///Users/LoweJunglegrove/Documents/Screen%20Shot%202014-04-22%20at%205.46.23%20PM.png

Ok, I see your code above. Make sure the file is named style.css and the directory structure is like this: Typical Directory Structure. Don't be concerned with the inc, img, and javascript directories.

I always find using the 'Type' (e.g. type="text/css") attribute solves this. Example: <link rel="stylesheet" type="text/css" href="css/style.css">

hey, guys its working now lol whatever not sure why it wasn't working maybe it was my internet connection or some such lunacy thx dudes!!!!