The styleMap read-only property of the CSSStyleRule interface returns a StylePropertyMap object which provides access to the rule's property-value pairs. 
 The styleMap read-only property of the CSSStyleRule interface returns a StylePropertyMap object which provides access to the rule's property-value pairs. 
A StylePropertyMap object.
 The following example shows styleMap being used to modify a style using the StylePropertyMap.set() method. 
js
const stylesheet = document.styleSheets[0]; Object.values(stylesheet.cssRules).forEach((block) => { if (block.selectorText === "button") { block.styleMap.set("--mainColor", "black"); } });
| Specification | 
|---|
| CSS Typed OM Level 1  # dom-cssstylerule-stylemap  | 
| Desktop | Mobile | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | |
styleMap | 
66 | 79 | No | No | 53 | 16.4 | 66 | 66 | No | 47 | 16.4 | 9.0 | 
    © 2005–2023 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
    https://developer.mozilla.org/en-US/docs/Web/API/CSSStyleRule/styleMap