javascript - Angular 10:Styles.css 未加载到 Index.html
问题描述
我在index.html
文件中添加了一个 html 元素,现在我想在其上添加一些样式。我已经在styles.css
文件中编写了样式代码,但它没有反映在index.html
元素上。
这是代码:
索引.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>
样式.css
.loading-head { color: red; }
角.json
"styles": [
"src/theme.less",
"src/styles.css"
],
文件结构
/src/
--index.html
--styles.css
/
--angular.json
角度版本
Angular CLI: 10.1.1
Node: 14.10.1
我无法弄清楚我做错了什么以及在哪里做错了。任何人都可以帮助我吗?
解决方案
推荐阅读
- javascript - 组件模板应该只包含一个根元素 nuxt
- ios - 添加shared_preferences后,我无法构建Flutter的iOS模拟器
- python - 用于将列表列表拆分为每个列表的第一个元素的列表的命令
- ruby-on-rails - 使用 rspec 测试 before_destroy 方法
- django - 在 Django REST ViewSet 视图/操作中使用全局查询集
- javascript - 在标签 HTML 上打印变量 PHP
- c++ - 部分专业化和对 std::void_t<> 的需求
- azure-data-factory - Azure 数据工厂管道 - 复制 blob 并将文件名存储在 DocumentDB 或 Azure SQL 中
- c - 如何在 C 中传递参数以便可以更改值?
- heroku - 删除后可以恢复heroku上的Postgres DB吗