| [ Web Proxy ] |
| Viewing: https://developer.mozilla.org/ja/docs/Web/API/CSSStyleRule/styleMap | [Back] [Original] |
Get to know MDN better
Want more browser support for this feature? Tell us why.
styleMap CSSStyleRule StylePropertyMap
styleMap StylePropertyMap.set()
const stylesheet = document.styleSheets[0];
Object.values(stylesheet.cssRules).forEach((block) => {
if (block.selectorText === "button") {
block.styleMap.set("--mainColor", "black");
}
});
| CSS Typed OM Level 1 # dom-cssstylerule-stylemap |
CSSStyleRuleCSSCSSConditionRuleCSSFontFeatureValuesMapCSSFontFeatureValuesRuleCSSFontPaletteValuesRuleCSSFunctionDeclarationsCSSFunctionDescriptorsCSSFunctionRuleCSSGroupingRuleCSSImportRuleCSSKeyframeRuleCSSKeyframesRuleCSSLayerBlockRuleCSSLayerStatementRuleCSSMediaRuleCSSNamespaceRuleCSSPageDescriptorsCSSPageRuleCSSPropertyRuleCSSRuleCSSRuleListCSSStartingStyleRuleCSSStyleDeclarationCSSStylePropertiesCSSStyleSheetCSSSupportsRuleCaretPositionMediaListMediaQueryListScreenStyleSheetStyleSheetList| Web Proxy Viewer | New URL | Original Page |