Home > database >  Why is CSS file not linking to HTML file in VSCode?
Why is CSS file not linking to HTML file in VSCode?

Time:10-12

I have both files in the same folder but for some reason I can't get them to link, here's what I have

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

Do i need to add the whole link to the directory? I've been told that's unecessary if they're in the same folder. I have tried multiple browsers and I get the same results.

Edit: this is what I have on VSCode, this is the very first time I try HTML and CSS and my programming knoweledge is very limited, sorry for my ignorance at this point.my code

CodePudding user response:

If both files are in the same folder, e.g.

  • site
    • page.html
    • style.css

Then your link need only be:

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

CodePudding user response:

You have to pass the correct relative path to the href-Attribute.

Just delete the "css/"

Look here

  • Related