问题
I can't get my CSS to show on the site. I really can't figure out what I'm doing wrong here, I'm very new to all of this so I'm sure there's something I just can't see.
here is the live site https://rusne118.github.io/mile-stone-one/4
here is my repo https://github.com/rusne118/mile-stone-one
here is my css in my html
here is my files on cloud9
回答1:
Remember that GitHub pages are scoped with repo names.
You are including your CSS with
<link rel="stylesheet" href="/css/style.css">
This resolves to https://rusne118.github.io/css/style.css
but you want https://rusne118.github.io/mile-stone-one/css/style.css
Simply change link tag to
<link rel="stylesheet" href="/mile-stone-one/css/style.css">
回答2:
Adding type="text/css"
to <link rel="stylesheet" href="style.css">
worked for me.
So finally it looked like <link rel="stylesheet" type="text/css" href="style.css">
In this case , the HTML file and the CSS file are located in the same folder.
回答3:
I had this problem and instead of doing:
<link rel="stylesheet" href="/css/style.css" />
I did:
<link rel="stylesheet" href="css/style.css" />
(without the first '/') And it worked fine.
来源:https://stackoverflow.com/questions/52003005/css-not-working-on-github-pages