Why can't CSS files and HTML files be linked correctly in VSCode?
P粉860370921
P粉860370921 2024-03-19 21:44:52
0
1
299

I have these two files in the same folder, but for some reason I can't link them, here is my code:

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

Do I need to add the entire directory in the link? I was told that this is unnecessary if they are in the same folder. I tried multiple browsers with the same result.

EDIT: This is my code on VSCode, this is my first time trying HTML and CSS, my programming knowledge is very limited, sorry for my current ignorance.

P粉860370921
P粉860370921

reply all(1)
P粉738346380

If two files are in the same folder, for example:

  • site
    • page.html
    • style.css

Then your link only needs to be:

<link rel="stylesheet" type="text/css" href="style.css">
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template