StylePropertyMap: set() method
Limited availability
This feature is not Baseline because it does not work in some of the most widely-used browsers.
Want more browser support for this feature? Tell us why.
The set() method of the StylePropertyMap interface changes the CSS declaration using the given property.
Syntax
js
set(property, value)
Parameters
Return value
None (undefined).
Examples
>Basic usage
This example sets the specified value for the padding-top property within the element's style attribute.
js
// get the button element
const buttonEl = document.querySelector("button");
// set padding-top on button style attribute
buttonEl.attributeStyleMap.set("padding-top", CSS.px(10));
Specifications
| Specification |
|---|
| CSS Typed OM Level 1> # dom-stylepropertymap-set> |