I am trying to load my simple website online hosted by Github.io. However, after countless and frustrating efforts of troubleshooting and debugging the HTML & CSS script, my web still couldn't get the CSS file loaded as desired for some really mysterious and extremely annoying reason.
Don't get me wrong:
- I swear my CSS file is put in the absolute path rather than the relative path as I firstly put it, so I will smash myself if it's the cause of the error.
- After a while couldn't figure out, I looked over similar or related issues posted on stackoverflow as well, some suggest that the access permission is maybe the reason, but I followed them with the command inside my directory of CSS file
chmod -R 777
But I don't see it resolves as well cuz the command has no effect, and I didn't run it at the root level
- I inspected this web on both Chrome and Safari, and the style.css is blank as it couldn't be loaded!!!
Now, I keep hold on this to wait for any of your "magic" helps. I deeply appreciate the help, as I tried my best fixing it already, but didnt work. Here is the just HTML link tag line where the file is not loaded.
<head>
....
<link rel="stylesheet" href="./_css/style.css">
</head>
If your
_css
directory is in the root, your CSS link should start with a slash:But naming your directory
_css
may be a problem. Github Pages by default treats your site as a Jekyll website, which processes your files and does not publish files/directories having_
prefix.I think you have 2 options:
.nojekyll
to bypass Jekyll processing._css
tocss
and also modify your<link>
tag.