简体   繁体   English

为什么 CSS 在我的 github 页面上不起作用?

[英]Why CSS is not working on my github pages?

I'm trying to deploy my react app on github as pages but the css isn't working.我正在尝试将我的 React 应用程序作为页面部署在 github 上,但 css 无法正常工作。 Im attaching my github repository if anyone can help.如果有人可以提供帮助,我会附上我的 github 存储库。 text .文字

As right now the page is looking totally messed cause not css is applied.因为现在页面看起来完全混乱,因为没有应用 css。

cLooking at generated index.html file in the gh-pages branch, I can see that the file is malformed; c 查看在gh-pages分支中生成的index.html文件,我可以看到该文件格式错误; you have missing closing tags in your HTML.您的 HTML 中缺少结束标记。

// index.html (I added newlines for readability)
<!doctype html>
  <html lang="en">
    <head>
      <meta charset="utf-8"/>
      <link>font-family: "Montserrat", sans-serif; href="https://fonts.googleapis.com/css?family=McLaren|Montserrat&display=swap" rel="stylesheet"
      <link>rel="stylesheet" href="./styles.css"
    ...

Notice the link tags aren't closed.注意link标签没有关闭。 Because of this, the CSS file will not be loaded by the browser.因此,浏览器不会加载 CSS 文件。

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

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