如何以及在何处使用 ::ng-deep? [英] How and where to use ::ng-deep?
问题描述
我是 Angular 4 的新手,所以谁能解释一下在 Angular 4 中如何以及在何处使用 ::ng-deep
?
其实我想从父组件覆盖子组件的一些CSS属性.另外IE11支持吗?
感谢您的帮助.
通常 /deep/shadow-piercing"
组合器可用于强制样式向下子组件
.这个选择器有一个别名 >>>现在还有一个叫做 ::ng-deep.
由于/deep/combinator
已被弃用,推荐使用::ng-deep
例如:
和css
.overview {::ng-深{p{&:last-child {底边距:0;}}}}
它将应用于子组件
I'm new to Angular 4, so could anyone please explain how and where to use ::ng-deep
in Angular 4?
Actually I want to overwrite some of the CSS properties of the child components from the parent components. Moreover is it supported on IE11?
Thanks for the help.
解决方案 Usually /deep/ "shadow-piercing"
combinator can be used to force a style down to child components
. This selector had an alias >>> and now has another one called ::ng-deep.
since /deep/ combinator
has been deprecated, it is recommended to use ::ng-deep
For example:
<div class="overview tab-pane" id="overview" role="tabpanel" [innerHTML]="project?.getContent( 'DETAILS')"></div>
and css
.overview {
::ng-deep {
p {
&:last-child {
margin-bottom: 0;
}
}
}
}
it will be applied to child components
这篇关于如何以及在何处使用 ::ng-deep?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文