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

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

问题描述

我正在从其样式文件中对角度组件进行样式设置,我发现必须使用: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屋!

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