hello guys I’m new here and I can’t figure out why CSS is not working on my Github pages. i tried a few solutions such as checking the directory etc. but none of them works. Can someone tell me a fix for this. Thanks
If the repository of the website you’re talkin about is this one (please, always provide links to actual repo and website if possible):
then the problem has to do with letter-casing of the CSS file, which is stored as STYLES.CSS in the repository, but referred to with different letter casing in the actual HTML…
<link rel="stylesheet" href="STYLES.css">
Then in index.HTML:
<link rel="stylesheet" href="styles.css">
Most web hosting services (including GitHub Pages) run on Linux, which (unlike Windows) has a case-sensitive file system. This means that same names with different letter casing are considered different files altogether.
You need to ensure that all references to assets name them correctly (using the actual case of their filename). Even better, just use lowercase filenames all the time, so you don’t forget.
The problem is that under Windows a website might look good because Windows doesn’t care about filenames casing, but then when you publish it online (on a Linux server) you get this type of problems.
By the way, if you’re using Win 10 you can now enable case-sensitive filenaming on directories of your choices, which means you can make the top level folder containing all your Git projects case-sensitive (like in Linux). Here’s how:
Enabling this will prevent similar errors to happen again, since you’d be able to see the problem locally, in your browser, as if you were working under Linux.
thanks a lot it worked.you made my day