How do you link CSS and HTML files on VS Code?

Hi all,

I’ve recently started using VS Code and have been unable to link the CSS and HTML files. I’ve uploaded a code snippet with the link tag I’m using. I’ve also tried copying and pasting the specific file pathway for the CSS file but this didn’t work either.

Any help gratefully appreciated - thanks!

FYI, it is better to paste your code in here than to provide a picture.

As for your example, in the directory that this HTML lives, is there a subdirectory named “css” and does a style sheet named “style.css” live in it?

Thanks for the tip! Yes, there is a folder for the project with an index.html file and style.css file.

So, are you saying that the folder structure is similar to this:

index.html
css
 ┗ style.css

If so, it should work I think.

Thank you for clarifying the folder structure. I can see now why it wasn’t working. The style.css file and index.html file are in the same folder; there is no separate CSS folder. I’ve amended the HTML to reflect this and it works. Brilliant - thanks for your help!

1 Like