Help with getting css to work #186068
-
Select Topic AreaQuestion BodyI've tried all the main solutions from normal thread, such as adding a .nojekyll file, putting in type="text/css", adding <meta http-equiv=“X-UA-Compatible” content=“ie=edge”><meta name=“viewport” content=“width=device-width, initial-scale=1.0”> and moving them around to see if that helped and none of it has fixed the issue. So I'm here to ask for help, and wondering if anyone knows another solution or knows more about pages and can see what the issue is. Here's my github link https://github.com/lunaskristoffersen/lunaskristoffersen.github.io/tree/main
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
|
Most developers use an absolute path like /style.css. On GitHub Pages, this points to username.github.io/style.css instead of username.github.io/repository-name/style.css. change the relative path to this: ( this code should also be correct because there are no any leading slashes) |
Beta Was this translation helpful? Give feedback.
-
|
To get that badge (likely the "Galaxy Brain" for a marked answer), you need a response that is comprehensive, empathetic, and covers the technical "gotchas" that most people miss. Here is a detailed, structured answer you can post. It covers the most common reasons this happens, starting from the most likely to the more obscure. Draft Answer for you to copy/adapt: Hi there! Since you've already ruled out the common Jekyll and meta tag issues, this is almost certainly a pathing or case-sensitivity issue. GitHub Pages is strict about these in ways local environments (like Windows) are not. Here is a checklist to debug and fix this:
The Check: If your file is named Style.css in your repo, but your HTML asks for style.css, it will fail on the live site even if it works locally. The Fix: Ensure the filename in your repo matches the href in your HTML exactly, including capitalization.
Best Practice: Use a relative path. If your index.html and style.css are in the same folder, use: HTML Common Mistake: Using /style.css (with a leading slash). On GitHub Pages, this often resolves to the root of the domain, which might break if your project is a repository site (e.g., username.github.io/projectname/).
Open your live site. Right-click and select Inspect (or press F12). Go to the Network tab. Refresh the page. Look for the line with your CSS file (it will likely be red/404). Hover over the name to see the full URL the browser is trying to fetch. Is it missing a folder name? (e.g., trying to find domain.com/style.css instead of domain.com/assets/css/style.css) Is it spelling it wrong?
The Fix: Try a "Hard Refresh" by pressing Ctrl + F5 (Windows) or Cmd + Shift + R (Mac) on the live site to force it to download the latest files.
HTML Make sure you aren't using "curly quotes" (like “ or ”) which can happen if you copy-pasted code from a blog.Check that the tag is inside the section of your HTML. Hopefully, one of these solves it for you! Let us know what the specific error URL was in the Network tab if it persists. |
Beta Was this translation helpful? Give feedback.

To get that badge (likely the "Galaxy Brain" for a marked answer), you need a response that is comprehensive, empathetic, and covers the technical "gotchas" that most people miss.
Here is a detailed, structured answer you can post. It covers the most common reasons this happens, starting from the most likely to the more obscure.
Draft Answer for you to copy/adapt:
Hi there! Since you've already ruled out the common Jekyll and meta tag issues, this is almost certainly a pathing or case-sensitivity issue. GitHub Pages is strict about these in ways local environments (like Windows) are not.
Here is a checklist to debug and fix this:
GitHub Pages r…