14

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

5 Answers 5

30

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">
Sign up to request clarification or add additional context in comments.

2 Comments

Assigning a custom domain would also resolve this, i.e. https://mile-stone-one.io/css/style.css
A little more context for newbies like myself: from the commandline I had to run bundle info --path minima because i'm using the minima theme. Then I had to open the theme in VSCode and edit the header listed in the _includes directory to match the top answer.
14

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/

4 Comments

This is was our problem as well. Thanks! Sorry to be pedantic, but it is "Sphinx" not "Sphynx".
Oh, I've fixed that typo, thanks.
This worked for me, instead of a) rechecking css paths, b) resetting the cache -- directly access the url with a hard refresh, c) try waiting couple more hours. Anyone who is sure they have the right path (check source and dev tools) and can confirm it's not the client's fault, ought to try this out.
In case it's about deploying dirs/files starting with '_', the following Jekyll configuration solved the issue for me: include: [_*] (For more info on docs_dir_base/_config.yaml Jekyll configuration, see: Configuring Jekyll in your GitHub Pages site)
7

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.

1 Comment

Thanks ,It worked for me too
6

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.

Comments

0

In my opinion, it just takes time man, a lot of time. Try, changing to another branch(maybe none) and save. Later change back to your main branch and save. Well worked for me but yeah took some time.

1 Comment

Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.