GitHub Pages Does Not Reflect CSS

Asked 1 years ago, Updated 1 years ago, 396 views

I am trying to publish my own website on GitHub using the code I wrote in VSCode.
Code is HTML and CSS only.I am troubled that CSS is not reflected.
The VSCode preview reflects it without any problems, but I don't know why.

Tried

1.<link rel="stylesheet" href="css/home.css">

<link rel="stylesheet" href="https://emmaoy.github.io/test_6/css/home.css">

changed to

2. Clearing the Cache

The code is at the following link:(I'm sorry that I can't find many image files.)
https://github.com/EmmaOY/test_6

Thank you for your cooperation.

html css github-pages

2022-12-11 22:15

1 Answers

If you look at the actual file configuration on the repository, index.html and home.css are in the same hierarchy, so you should also specify the CSS file as follows:(css/ folder specification was unnecessary)

<link rel="stylesheet" href="https://emmaoy.github.io/test_6/home.css">

Alternatively, it may be better to specify the relative path.

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


2022-12-11 22:44

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.