您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
inject stylus to 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