1

When I try to open my html file directly by clicking on it, it's not loading the CSS file or images but when I open it with VS code live server it working fine. The images and stylesheet is on different files

here is the code : <link rel="stylesheet" href="/CSS files/stylesheet.css" type="text/css"> <meta charset="UTF-8">

MrM-roy
  • 11
  • 1
  • When you directly click on the html file, go to inspect page and check the link tag you provided. If you hover over the `href` attribute it will show what file location it is pointing to. I think in your case it might be pointing to the wrong location. – kipteam Aug 09 '23 at 15:00

1 Answers1

0

Try this answer https://stackoverflow.com/a/16643104/22147483. The href attribute in your code appears to use an absolute path.

Edit.: Try adding a './' before the path to the file to use a relative path.

marcelo
  • 1
  • 2