嵌套SCSS应用于Angular中的儿童组件时不起作用
父级 HTML
<childComponent class="applyToChild"> </childComponent>
在子组件中父级的 HTML
<p>ABCD</p>
<ul>
<li>
<p> XYZ </p>
<li>
</ul>
.scss(在父级组件中应用样式)未重新映射
.applyToChild{
p {
font-size:25px;
}
ul
{
li{
background-color:blue;
}
}
}
Parent HTML
<childComponent class="applyToChild"> </childComponent>
In ChildComponent HTML
<p>ABCD</p>
<ul>
<li>
<p> XYZ </p>
<li>
</ul>
.scss of Parent (applying styles in the parent component) is not getting refeleted
.applyToChild{
p {
font-size:25px;
}
ul
{
li{
background-color:blue;
}
}
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这很可能是因为您的样式已封装。解决此问题的一种方法是使用:: ng-deep-pseudo-selector:
This is most likely because your style is encapsulated. One way around this is to use the ::ng-deep pseudo-selector: