:host,:host(),:host-context选择器之间有什么区别 [英] What is the different between :host ,:host() ,:host-context selectors
问题描述
我正在从其样式文件中对角度组件进行样式设置,我发现必须使用:host,:host()或:host-context >选择器,它们之间有什么区别?
I 'm styling an angular component from it 's style file ,I have found that I have to use :host ,:host() or :host-context selector , What is the different between each of them?
推荐答案
:host
是样式主机组件的语法.
:host
Is syntax for styling the host component.
是一个实验性CSS伪类函数,它选择the shadow host of the shadow DOM containing the CSS it is used inside
(
Is an experimental CSS pseudo-class function that selects the shadow host of the shadow DOM containing the CSS it is used inside
(Reference)
是用于在当前元素之外的任何地方设置特定类样式的语法.该类必须已经应用于当前元素范围之外的元素.
Is syntax for styling a specific class anywhere outside the current element. The class must already be applied to an element outside the scope of the current element.
可以在此博客中找到有关Angular应用程序上下文的更多深入信息.发布.
这篇关于:host,:host(),:host-context选择器之间有什么区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!