Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to link css files in organization github pages

I'm trying to add an external css file in my index.html.

Organization-name - codehunks

My directory structure is as:

codehunks.github.io
    _layouts/
        style.css
    LICENSE.txt
    README.rst
    index.html

I tried adding it as:

<link rel="stylesheet" type="text/css" href="_layouts/styles.css"/>

but it didn't work. I searched and get to know that raw.github.com/../.. doesn't work in case of css/text

I found some articles adding it by providing link as [username].github.io/[repo]/[folder]/[filname] but this didn't work for my organization.

I tried adding it as codehunks.github.com/codehunks.github.io/_layouts/style.css but the link is giving me 404 not found response.

Any possible solution or I'm following something wrong.

Here's my page codehunks.github.io and here's my code Source Code

like image 582
softvar Avatar asked Jul 19 '13 19:07

softvar


People also ask

How do I link my CSS stylesheet to GitHub?

You can use some way: Recommend: <link type="text/css" rel="stylesheet" href="style. css" />

How do I link CSS files to each other?

Note: There are two different ways to import a CSS file into another using @import url(“style2. css”); or @import “style2. css”; or directly import any CSS file or multiple CSS file in the HTML file directly within <style>@import “style1.

Can you use CSS on GitHub Pages?

GitHub Pages is a static site hosting service that takes HTML, CSS, and JavaScript files straight from a repository on GitHub, optionally runs the files through a build process, and publishes a website. You can see examples of GitHub Pages sites in the GitHub Pages examples collection.


1 Answers

your style will work at /styles.css if you put it in the root, _layout folder is used by jekyll/ruby.

create a css folder in the root of your repo and put the style in there.

/css/style.css instead.

like image 181
Mat Avatar answered Oct 05 '22 12:10

Mat