【问题标题】:External stylesheet from github not linking来自github的外部样式表没有链接
【发布时间】:2021-05-09 18:34:07
【问题描述】:

所以到目前为止,我一直使用与我的网站位于同一文件夹中的样式表,但我希望更加灵活并通过 github 处理我的布局。所以我上传了css文件并使用了原始链接。我注意到我不能使用它。甚至可以使用来自网站的样式表吗?我试图在互联网上找到答案,但找不到有关此问题的文章。 这是我的代码:

<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>

【问题讨论】:

    标签: html css github stylesheet


    【解决方案1】:
    <head>
        <link rel="stylesheet" type="text/css" href="https://gitcdn.link/repo/Goetterescu/Website/main/styles.css">
    </head>
    

    我使用 https://gitcdn.link/ 提供样式表,因为 Github 使用错误的样式表提供样式表

    【讨论】:

      【解决方案2】:

      您应该使用这种类型的文件路径指向您的 css 文件。 GitHub 文件目录应指向存储库中链接文件的相对路径。

      <html>
      <head>
      <link rel="stylesheet" type="text/css" href="styles.css">
      </head>
      
      <body>
      <h1>Hello there</h1>
      </body>
      </html>
      

      【讨论】:

        猜你喜欢
        • 2012-02-25
        • 2017-04-05
        • 2011-07-19
        • 2013-11-16
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2013-12-08
        • 2014-06-06
        相关资源
        最近更新 更多