Inject Stylus into shadowRoots

inject styles of stylus-addon in shadowRoot

作者
hdyzen
日安装量
0
总安装量
0
评分
0 0 0
版本
1.1
创建于
2025-06-29
更新于
2025-06-29
大小
1.6 KB
许可证
GPL-3.0-only
适用于
所有网站

Inject Stylus into shadowRoots

This userscript injects styles from the Stylus extension directly into shadowRoot instances, allowing you to style the content of web components.


How to style content inside a shadowRoot

:host

To apply styles only to the content within a shadowRoot, use the :host pseudo-selector in your Stylus styles. :host refers to the element that contains the shadowRoot (the shadow host).

/* All elements */
* {
  border: 1px violet;
}
/* Only elements inside the shadowRoot */
:host * {
  border: 1px solid mediumpurple;
}

Similar forms:

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址