角度10:Styles.css无法加载到Index.html

问题描述

我在index.html文件添加一个html元素,现在我想在其上添加一些样式。我已经在styles.css文件中编写了样式代码,但是没有反映在index.html元素上。

代码如下:

Index.html

<!DOCTYPE html>
<html lang="en">
  <head>
    <Meta charset="utf-8" />
    <title>Angular App</title>
    <base href="/" />
    <Meta name="viewport" content="width=device-width,initial-scale=1" />
    <link
      rel="icon"
      type="image/x-icon"
      href="https://icons.com/emoj-symbol-30763.png"
    />
  </head>
  <body>
    <app-root>
      <h2 class="loading-head">Loading .........</h2>
    </app-root>
  </body>
</html>

Styles.css

.loading-head { color: red; }

angular.json

  "styles": [
     "src/theme.less","src/styles.css"
  ],

文件结构

/src/
  --index.html
  --styles.css
/
  --angular.json

角度版本

Angular CLI: 10.1.1
Node: 14.10.1

我无法弄清楚我在哪里做错什么。有人可以帮我吗?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)