语法
js
set(property, value)
参数
property(属性)-
一个标识符,指示要更改的样式特性(例如,字体、宽度、背景颜色)。
value-
给定属性应具有的值。
返回值
无(undefined)。
示例
此示例在元素的 style 属性中设置 padding-top 属性,并使用给定值。
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));
规范
| 规范 |
|---|
| CSS 类型化 OM Level 1 # dom-stylepropertymap-set |
浏览器兼容性
加载中…