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

Hard time trying to use external css stylesheet

I've tried everything I know of so far, but I can't get the path to work.

I have a folder (called - page), inside of it there is an html file and a css folder (called - css), inside the css folder you find the css file called - styles.

I think the path is correct, but no css is applied to the html.

How do I actually use an external css stylesheet (inside my computer)?

<link 
href="C:\Users\Peter\Desktop\page\css\styles.css" 
type = "text/css" 
rel="stylesheet"
/>

1 Answer

You can create a link relative to the current file's location, which is your HTML file. For example, your CSS file resides in -

href="css/styles.css"

Also remember that Windows uses backslashes, but you'll want to use forward slashes for paths in HTML.