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

linking css to html doc for a website

hi, my css doc for the 'bakin' website has not linked to my html doc. Therefore the colours etc, on my site have not changed. My computer is a pc, I have downloaded treehouse's docs for this task to my desktop and saved my css doc into there. Any suggestions on what step I have missed here?

5 Answers

Have you put the correct link to the style sheet in your head tags? also check if the css file is in the correct folder

If you are still having a problem with your CSS doc, try posting your HTML code from the head part of the page. I'll be on and off the forums all day and I would be happy to lend a hand if I can.

Thank you. I think I have written the link wrong. For the other links I have been using treehouses, but for this it will need to come from mine. Do you know how to write the links correctly. I have downloaded treehouses docs and saved them on my desktop. I have saved my css style folder in the css general folder. How do I write a link to this? href="desktop/treehousedocs/css.stylecss"

here is the html code <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> <title>Smells Like Bakin' Cupcake Company</title> <link rel="stylesheet" href="http://treehouse-code-samples.s3.amazonaws.com/WWIsland1/stage3/css/normalize.css" type="text/css" media="screen"> <link rel="stylesheet" href="http://treehouse-code-samples.s3.amazonaws.com/WWIsland1/stage3/css/grid.css" type="text/css" media="screen"> <link href='http://fonts.googleapis.com/css?family=Nunito' rel='stylesheet' type='text/css'> <link rel="stylesheet" href="desktop/treehouse/css/style.css" type="text/css" media="screen"> </head>

Matthew Mascioni
Matthew Mascioni
20,444 Points

Hi Tracy,

Stylesheet documents do end in .css, so changing css.stylecss to css.css or renaming it to style.css might be a quick fix there :)

Thank you, that was helpful advice, I have tried <link rel="stylesheet" href="desktop/treehouse/css/style.css" type="text/css" media="screen">, but still no luck :(

Matthew Mascioni
Matthew Mascioni
20,444 Points

Sorry to hear that! :(

Two things:

  1. Ensure your link tag is properly formed A link tag to link a CSS stylesheet to a HTML document looks like this: <link rel="stylesheet" type="text/css" href="style.css" />

  2. Verify the location of your stylesheet A common mistake is having the wrong path to your CSS file. If I had a folder with my HTML files in it, and the CSS files were in the same folder as the HTML files that are linking to it, I could simply write: <link rel="stylesheet" type="text/css" href="style.css" /> (or whatever it's named)

Hope this helps!

Matthew Mascioni
Matthew Mascioni
20,444 Points

Sorry to hear that! :(

Two things:

Ensure your link tag is properly formed

A link tag to link a CSS stylesheet to a HTML document looks like this, where style.css is the filename of your stylesheet:

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

Verify the location of your stylesheet

A common mistake is having the wrong path to your CSS file. If I had a folder with my HTML files in it, and the CSS files were in the same folder as the HTML files that are linking to it, I could simply write:

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

(or whatever it's named)

Hope this helps!

Thank you so much for your time, I really appreciate it. I am still missing something. I think I have saved my files wrong? Fortunately I have a kind friend who will give me a hand later. Have a great day.