简体   繁体   中英

css not working for github pages

my css is not working correctly on my github page. This is my repo . This is my website . I created this portfolio website without Github pages and it works correctly. I am very new to github , so there is a good chance I'm missing something. I usually localize all my css/jscript but for simplicity reasons I changed all my css/javascript to the html link.

<!doctype html>
<html>
<head>

<link rel="stylesheet" type="text/css" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">


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


</head>

I had the same problem with my HTML file and my CSS file. I fixed it like this:

  1. I had a repo with the index.html and a folder call "style" with the style.css file in it.
  2. Deploy my index.html with the link tag within the head tag like this:
<link rel="stylesheet" href="./style/style.css" type="text/css">

Pay attention to the href attribute: "./style/style.css".

Andy.-

Like @TarasYaremkiv mentioned remove your './css/bootstrap-3.3.7/' folder.

The reason why it's happening is because Jekyll engine is looking for the includes present in the file 'bootstrap-3.3.7/docs/components.html'

For example: this file {% include components/glyphicons.html %} is not present in the components directory of your bootstrap folder. Hence the error.

You can avoid these kind of error's by downloading only the necessary compiled files or use cdn links

Change

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

to

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

original post - External CSS not working with Github Pages

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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