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
If you put the <link> tag inside another valid header tag like <title> or <script> tag, then the CSS won't work. The external style CAN be put inside the <body> tag, although it's recommended to put it in the <head> tag to load the style before the page content.
You need to link your HTML to the github page rendered style. css and not the file itself in the repo. And move that stylesheet reference inside your <head> tag.
GitHub Pages publishes any static files that you push to your repository. You can create your own static files or use a static site generator to build your site for you. You can also customize your own build process locally or on another server.
Solution: Verify the publishing source and published URL from your repository's settings tab. Double check that you are using the correct URL by visiting your repository's Settings, and scrolling down to the GitHub Pages section. You should see the URL where your site is published.
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">
For us, the solution was to add an empty .nojekyll
file to the root of the repo.
We used Sphinx to generate the site which places CSS in _static/css
folder.
Explanation:
It is now possible to completely bypass Jekyll processing on GitHub Pages by creating a file named .nojekyll in the root of your pages repo and pushing it to GitHub. This should only be necessary if your site uses files or directories that start with underscores since Jekyll considers these to be special resources and does not copy them to the final site.
Source: https://github.blog/2009-12-29-bypassing-jekyll-on-github-pages/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With