Please check the link tag attributes and it's values are properly spelled. text\css will never load css file. The correct is text/css (it's forward slash). Also try to open the html file from file explorer and check if it's working.
<link rel="stylesheet" type="text/css" href="style.css" />
Answer from Rajdeep D on Stack OverflowPlease check the link tag attributes and it's values are properly spelled. text\css will never load css file. The correct is text/css (it's forward slash). Also try to open the html file from file explorer and check if it's working.
<link rel="stylesheet" type="text/css" href="style.css" />
I was able to get it to work by reinstalling the live server extension on vscode. Hope this helps!
Videos
Hello guys,
I'm having some trouble with a vanilla JS project. I'm used to React and never do projects in vanilla.
So a friend sent me his project, there are two folders in it : templates with all the html files, and dist with all the js, css, etc.
The entry point of his app is login.html. When I open this file with live server (in VS Code), the html is loaded, but not the JS nor the CSS.
By opening the console, I think I found the problem but I wanna be sure.
consoleDo I need to access his backend to work on the frontend?
Thanks for your help!
It is more likely you have not linked the css file appropriately. If it persists, have your css code within style tags within the head tag of you html code
Remove your Cache first. If you have linked properly then it will need to work properly. First check your CSS link path and secondly remove your cache.
I had the same problem. In my case, it was caused by a typo in the file path of my css. I have no idea why liver server ignored it and put the file correctly anyways.
The problem was that I had:
<link href="/style.css">
Instead of:
<link href="style.css">
So check your files paths. Maybe the problem is there.
Basic live server is configured to launch in the Root folder of the server.
So the relative path for the CSS file will change depending on the launch via live server or directly from the browser.
If I understood correctly.
I encountered this error.