简体   繁体   English

如何在组织github页面中链接css文件

[英]how to link css files in organization github pages

I'm trying to add an external css file in my index.html . 我正在尝试在index.html添加外部css文件。

Organization-name - codehunks 组织名称 - 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 我搜索并了解raw.github.com/../..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. 我发现一些文章通过提供链接作为[username].github.io/[repo]/[folder]/[filname]添加它,但这对我的组织不起作用。

I tried adding it as codehunks.github.com/codehunks.github.io/_layouts/style.css but the link is giving me 404 not found response. 我尝试将其添加为codehunks.github.com/codehunks.github.io/_layouts/style.css但该链接正在向我发送404 not found响应。

Any possible solution or I'm following something wrong. 任何可能的解决方案或我正在做错事。

Here's my page codehunks.github.io and here's my code Source Code 这是我的页面codehunks.github.io ,这是我的代码源代码

your style will work at /styles.css if you put it in the root, _layout folder is used by jekyll/ruby. 你的风格将在/styles.css中工作,如果你把它放在根目录中,_layout文件夹由jekyll / ruby​​使用。

create a css folder in the root of your repo and put the style in there. 在您的仓库的根目录中创建一个css文件夹,并将样式放在那里。

/css/style.css instead. /css/style.css而不是。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM