Skip to content

How can I use github to host an external CSS file?

I uploaded my css to github, then went to the file on the site and clicked the raw option. I tried adding it to a webpage, but chrome is giving me the following errors:

Resource interpreted as Stylesheet but transferred with MIME type text/plain: “”.


Cross-Origin Read Blocking (CORB) blocked cross-origin response with MIME type text/plain. See for more details.

What can I do to add this CSS successfully? I’m adding it with javascript too:

var link = document.createElement('link');
link.setAttribute('rel', 'stylesheet');
link.setAttribute('type', 'text/css');
link.setAttribute('href', '');



You can host your files on Github Pages, Just go to repo settings[1], find “Github Pages” section and set your branch[2] and click “Save”. You will se the info[3]. Then you go to https://YOUR-GITHUB-USERNAME/REPO-NAME (If you have index.html or any file eg. /src/css/style.css) You can load the CSS, JS or other files on any site

<link rel="stylesheet" href="path/to/file/style.min.css">






Success Info

User contributions licensed under: CC BY-SA
1 People found this is helpful