来自 github 的外部样式表未链接
External stylesheet from github not linking
所以直到现在我一直使用与我的网站位于同一文件夹中的样式表,但我想更灵活地通过 github 处理我的布局。所以我上传了 css 文件并使用了原始 link。我注意到我不能使用它。甚至可以使用网站的样式表吗?我试图在互联网上找到答案,但找不到关于此问题的文章。
这是我的代码:
<html>
<head>
<link rel="stylesheet" type="text/css" href="https://raw.githubusercontent.com/Goetterescu/Website/main/styles.css">
</head>
<body>
<h1>Hello there</h1>
</body>
</html>
您应该使用这种类型的文件路径指向您的 css 文件。 GitHub 文件目录应指向存储库中链接文件的相对路径。
<html>
<head>
<link rel="stylesheet" type="text/css" href="styles.css">
</head>
<body>
<h1>Hello there</h1>
</body>
</html>
<head>
<link rel="stylesheet" type="text/css" href="https://gitcdn.link/repo/Goetterescu/Website/main/styles.css">
</head>
我使用 https://gitcdn.link/ 提供样式表,因为 Github 使用错误的样式表提供它
所以直到现在我一直使用与我的网站位于同一文件夹中的样式表,但我想更灵活地通过 github 处理我的布局。所以我上传了 css 文件并使用了原始 link。我注意到我不能使用它。甚至可以使用网站的样式表吗?我试图在互联网上找到答案,但找不到关于此问题的文章。 这是我的代码:
<html>
<head>
<link rel="stylesheet" type="text/css" href="https://raw.githubusercontent.com/Goetterescu/Website/main/styles.css">
</head>
<body>
<h1>Hello there</h1>
</body>
</html>
您应该使用这种类型的文件路径指向您的 css 文件。 GitHub 文件目录应指向存储库中链接文件的相对路径。
<html>
<head>
<link rel="stylesheet" type="text/css" href="styles.css">
</head>
<body>
<h1>Hello there</h1>
</body>
</html>
<head>
<link rel="stylesheet" type="text/css" href="https://gitcdn.link/repo/Goetterescu/Website/main/styles.css">
</head>
我使用 https://gitcdn.link/ 提供样式表,因为 Github 使用错误的样式表提供它