首页 > 解决方案 > Angular 项目中的 CSS

问题描述

我有一个以文件命名about的文件夹,about.component.css 我希望背景颜色aqua仅用于页面about.component.html

如果我在文件中about.component.css这样做:

body {
    background-color: aqua;
}

什么都没有显示... CSS 中的这个文件在这个路径上: C:\dev\demo\src\app\home\home.component.css

我认为我必须在home.component.css某处调用文件?

谢谢

标签: angular

解决方案


:host {
 background-color: aqua;
}

推荐阅读