CSSStyleDeclaration.removeProperty() - Web APIs 编辑
The CSSStyleDeclaration.removeProperty()
method interface removes a property from a CSS style declaration object.
Syntax
var oldValue = style.removeProperty(property);
Parameters
property
is aDOMString
representing the property name to be removed. Note that multi-word property names are hyphenated and not camel-cased.
Return value
oldValue
is aDOMString
equal to the value of the CSS property before it was removed.
Exceptions
DOMException
NO_MODIFICATION_ALLOWED_ERR: if the property or declaration block is read only.
Example
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');
Specifications
Browser compatibility
BCD tables only load in the browser
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论