search

Home  >  Q&A  >  body text

Why can't CSS files and HTML files be linked correctly in VSCode?

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粉860370921P粉860370921327 days ago323

reply all(1)I'll reply

  • P粉738346380

    P粉7383463802024-03-20 20:12:03

    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">

    reply
    0
  • Cancelreply