Home > Blockchain >  Github not loading css file when deployed by github pages
Github not loading css file when deployed by github pages

Time:02-20

I was working on a preview card component and when I uploaded my code to a repo to deploy it, github doesn't seem to load my css file style.

note: not my first time to deploy on github pages. thanks in advance!

repo link: https://github.com/HanyAyad/Stats-preview-card-component-

live-website link on github pages: https://hanyayad.github.io/Stats-preview-card-component-/

same website deployed on netlify (working fine): https://62116b02da6915993f04d79c--suspicious-hypatia-156ece.netlify.app/

CodePudding user response:

Maybe because the folder is CSS/styles.css and your declaration in index.html is css/styles.css?

CodePudding user response:

I just tested here and when importing your CSS file, you are using

<link rel="stylesheet" href="css/style.css">

when you should be using

<link rel="stylesheet" href="CSS/style.css" >

CodePudding user response:

The directory in your repo is named CSS and not css as expected. So, please rename the directory.

It only works on Netlify because it doesn't take casing into account, for some reason. (That is, https://62116b02da6915993f04d79c--suspicious-hypatia-156ece.netlify.app/CsS/sTyLe.css works fine.)

CodePudding user response:

URLs may be case-sensitive, it depends on what file system you are running your website.

Try renaming the folder CSS to css.

  • Related