CSS not applied via github-pages

Hi, everyone. I’m trying to set up a website via github-pages. HTML perfectly works, but CSS is not completely being applied to the page. I know the most possible reason is incorrect referencing(ex. /css/main.css > css/main.css), however I don’t see any referencing issues in my view. What did I miss in this case? :frowning:

Hi @gioh1218, welcome to the GitHub Support Community! You’re right, it is a reference issue. Your CSS is broken because the URL the browser is using to load it is missing the repository name /kokoa-clone-2020 section from the URL. You’re currently loading your CSS like this:

<link rel="stylesheet" href="/css/main.css">

This means that the URL the browser uses for this file is this: https://gioh1218.github.io/css/main.css

The initial / here tells the browser to look at the root of the domain https://gioh1218.github.io/ for this file path, instead of inside the /kokoa-clone-2020 “directory”.

To fix this you can just remove the initial / character. Alternately you can use the HTML <base> tag to do this for all relative links on the page: