English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
JavaScript CSSStyleDeclaration Object
setProperty()The function is used to: set a new value for the attribute of the CSS style declaration object.
object.setProperty(property, value, priority)
var declaration = document.styleSheets[0].rules[0].style; declaration.setProperty('color',39;coral');Test See‹/›
All browsers fully support the setProperty() method:
Method | |||||
setProperty() | Yes | Yes | Yes | Yes | Yes |
Parameter | Description |
---|---|
property | (Required) A string representing the name of the attribute to be added or modified |
value | (Optional) A string representing the new value |
priority | (Optional) A string indicating whether the priority of the attribute should be set to important Accepts the following values:
|
Return Value: | Undefined |
---|---|
DOM Version: | CSS Object Model |