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

HTML and CSS not linking

Hello,

I'm working on a personal project as I work my way through the basics. I'm trying to link my html and css together.

I have my index.html and my css file in a folder call CitySite.

Here is my code within the head tags:

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

I'm trying to test it out, so inside my css is some basic property changes:

body { color: blue; } h1 { color: green; }

When I pop open the console it says "Failed to load resource: net::ERR_FILE_NOT_FOUND"

1 Answer

Hi,

Here's the proper way to link css file with your html file :

Inside your index.html , write following piece of code within head tags,

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

Apart from Treehouse, your best friend for front end development and projects is W3School, Do give it a try

Here's the link for it : W3Schools

Enjoy Learning and Happy Coding :)

  • Zain

Thanks for the help, is the type required? I've never seen it before.

I also realized my issue was that I never put .css after the file name. Once I changed that it all worked.