Home > Back-end >  Why is my CSS file not linking to my HTML file on VS Code?
Why is my CSS file not linking to my HTML file on VS Code?

Time:01-07

I'm working on VS code, and I'm having difficulty linking my style sheet to my index.html file. When I look at the folder that my files are in, my css file saves as a web page-- is that typical? I'm wondering if that is my problem...

The code that I am using to link my css file to my html file is:

link rel="stylesheets" type="text/css" href="stylesheets.css"

The above code is wrapped in <>...but when I put it into the question, the code ends up not showing up, so that's why does are missing.

Thank you in advance!

CodePudding user response:

I think the problem is in the rel you should use stylesheet instead of stylesheets

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

and make sure stylesheets file and HTML file in the folder

CodePudding user response:

if your .css file is located in the same folder as .html file use:

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

and if it is in the different folder use :

   <link rel="stylesheet" href="./folderName/style.css">
  •  Tags:  
  • Related