已废弃
This feature is obsolete. Although it may still work in some browsers, its use is discouraged since it could be removed at any time. Try to avoid using it.
CSSStyleDeclaration.getPropertyCSSValue() 方法接口返回一个CSSValue
包含一个属性的CSS值。请注意,如果属性名称是速记属性,则返回null。
语法
let value = style.getPropertyCSSValue(property);
参数
property
is aDOMString
representing the property name to be retrieved.
返回值
value
is aCSSValue
containing the CSS value for a property. If none exists, returnsnull
.
示例
The following JavaScript code gets an object containing the computed RGB values of the color
CSS property:
var style = window.getComputedStyle(elem, null);
var rgbObj = style.getPropertyCSSValue('color').getRGBColorValue();
规范
Specification | Status | Comment |
---|---|---|
Document Object Model (DOM) Level 2 Style Specification CSSStyleDeclaration |
Obsolete | Declared as obsolete in July 2003. |
浏览器兼容性
BCD tables only load in the browser