In localhost, my HTML connects to my CSS file and can read my images but not on GitHub pages.
Why? Am I referencing it wrong for GitHub pages?
<link rel="stylesheet" type="text/css" href="/css/loan_sharks_page.css">
<img src="/assets/img/LS_icon.png" width="300" height="300" />
I have also tried:
<link rel="stylesheet" type="text/css" href="./css/loan_sharks_page.css">
<img src="./assets/img/LS_icon.png" width="300" height="300" />
And I have tried:
<link rel="stylesheet" type="text/css" href="css/loan_sharks_page.css">
<img src="assets/img/LS_icon.png" width="300" height="300" />
Each time I pushed to GitHub, I waited an hour cause I know GitHub pages sometimes takes a while. All of these work on localhost but not on Github pages.
CodePudding user response:
I think the problem is, that you can't upload a folder for images. Therefore your source for the image won't work. I put all images and HTML file at same hierarchy level and it worked fine for me. for example,
CodePudding user response:
type in your GitHub page URL on the browser followed by /index.html
that should work.
If not check your href on your Html file & make sure it is correct.
CodePudding user response:
Just remove the /
before the path and make sure that you have the same folder and file name. It should be working without any problem.
<link rel="stylesheet" href="css/loan_sharks_page.css">