I backed up my files on Github and now the CSS file ONLY works when I open it through a live server. It does does work when I select view with default browser nor when I open the html file.
i tried looking online for help, I tried relinking the CSS page. The code is fine and works with live server only.
this is how I linked the CSS:
<link rel="stylesheet" type="text/css" href="/Root Directory/first-fantastic-engine-1/Root Folder/Home page/Fun project/CSS/style.css"/>
Im new to coding and I made alot of files a while back for my code.
2
Answers
Like the others have suggested, it could just be an issue with path. Hard to provide the definite answer without taking a look at the error. If you can provide that it would make things easier.
As far as folder structure goes, there are some basic principles that you can follow such as using camelCase or kebab-case.
Take a look at this – https://ecss.benfrain.com/chapter5.html
Folder structure and naming conventions are some of the first things i would recommend to learn if you are a newbie.
You described a case when your CSS file does not show properly without a live server. It might relate to one of the common problems that are usually solved by checking a couple of key things. Here are some steps that will help you troubleshoot and fix the issue:
<link>
tag appears to be very specific and might not work when opening the file directly in a browser. Here’s a simplified version of your link:This assumes your HTML file and the
CSS
folder are in the same directory. If they are not, adjust the path accordingly.If your CSS file is in a different directory relative to your HTML file, make sure to navigate correctly:
F12
orCtrl+Shift+I
) and look for any errors related to loading the CSS file. This can provide more insight into what might be going wrong.If you’re still having trouble, providing more details about your directory structure or any error messages you’re seeing in the console can help the community offer more specific advice.
Have a nice day <3.