CSSStyleDeclaration.removeProperty()
method interface removes a property from a CSS style declaration object.
var oldValue = style.removeProperty(property);
property
是
DOMString
representing the property name to be removed. Note that multi-word property names are hyphenated and not camel-cased.
oldValue
是
DOMString
equal to the value of the CSS property before it was removed.
DOMException
NO_MODIFICATION_ALLOWED_ERR: if the property or declaration block is read only.
The following JavaScript code removes the
background-color
CSS property from a selector rule:
var declaration = document.styleSheets[0].rules[0].style;
var oldValue = declaration.removeProperty('background-color');
| 桌面 | 移动 | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
removeProperty
|
Chrome 1 | Edge 12 | Firefox 1 | IE Yes | Opera Yes | Safari 6 | WebView Android 4.4 | Chrome Android 18 | Firefox Android 4 | Opera Android Yes | Safari iOS Yes | Samsung Internet Android 1.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