:host ,:host() ,:host-context 选择器之间有什么区别 [英] What is the different between :host ,:host() ,:host-context selectors

查看:51
本文介绍了:host ,:host() ,:host-context 选择器之间有什么区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在从它的样式文件中设置角度组件的样式,我发现我必须使用 :host ,:host():host-context> selector ,它们之间有什么不同?

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 伪类函数,它选择 包含它在内部使用的 CSS 的影子 DOM 的影子主机(参考)

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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆