你正在訪問的內容是外部程式的映像位址,僅用於使用者加速訪問,本站無法保證其可靠性。當前的連結位址(單點即可複製)為 https://greasyfork.org.cn/zh-CN/scripts/541149-inject-stylus-into-shadowroots,源站連結 點此以跳轉。
inject styles of stylus-addon in shadowRoot
Userscript that automatically injects styles from Stylus (and other userstyle managers) into any shadowRoot.
This allows you to customize web components and encapsulated elements that normally would not inherit your styles.
The key selector is :host.
It refers to the shadow host element of the shadowRoot, letting you apply styles only inside the shadow boundary.
/* Apply to all elements on the page */
* {
border: 1px solid violet;
}
/* Apply only to elements inside the shadowRoot */
:host * {
border: 1px solid mediumpurple;
}
/* Apply styles only if the host has a specific class */
:host(.dark-theme) {
border: 1px solid blue;
}
GPL-3.0-only