过时
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()
method interface returns a
CSSValue
containing the CSS value for a property.
Note that it returns
null
if the property name is a shorthand property.
应使用
CSSStyleDeclaration.getPropertyValue()
代替。
var value = style.getPropertyCSSValue(property);
property
是
DOMString
representing the property name to be retrieved.
value
是
CSSValue
containing the CSS value for a property. If none exists, returns
null
.
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();
| 规范 | 状态 | 注释 |
|---|---|---|
|
Document Object Model (DOM) Level 2 Style Specification
The definition of 'CSSStyleDeclaration' in that specification. |
过时 | Declared as obsolete in July 2003 . |
| 桌面 | 移动 | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
getPropertyCSSValue
弃用
|
Chrome
? — 41
|
Edge
No
|
Firefox
1 — 62
|
IE No |
Opera
15 — 28
|
Safari 6 |
WebView Android
? — 41
|
Chrome Android
? — 41
|
Firefox Android 4 — 62 |
Opera Android
14 — 28
|
Safari iOS Yes |
Samsung Internet Android
? — 4.0
|
完整支持
不支持
弃用。不要用于新网站。
见实现注意事项。
CSSStyleDeclaration
getPropertyCSSValue()
getPropertyPriority()
getPropertyValue()
item()
removeProperty()
setProperty()
AnimationEvent
CSS
CSSConditionRule
CSSGroupingRule
CSSKeyframeRule
CSSKeyframesRule
CSSMediaRule
CSSNamespaceRule
CSSPageRule
CSSRule
CSSRuleList
CSSStyleRule
CSSStyleSheet
CSSSupportsRule
CaretPosition
LinkStyle
MediaQueryList
MediaQueryListListener
Screen
StyleSheet
StyleSheetList
TransitionEvent