CSSStyleDeclaration.removeProperty()

这篇翻译不完整。请帮忙从英语翻译这篇文章

CSSStyleDeclaration.removeProperty() 方法移除style对象的一个属性。

语法

var oldValue = style.removeProperty(property);

参数

  • property 是一个代表要移除的 DOMString 属性。

返回值

  • oldValue is a 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.

例子

下面的 JavaScript 代码从样式表里移除了 margin 属性:

var declaration = document.styleSheets[0].rules[0].style;
var oldValue = declaration.removeProperty('margin');

Specifications

Specification Status Comment
CSS Object Model (CSSOM)
CSSStyleDeclaration.removeProperty()
Working Draft  
Document Object Model (DOM) Level 2 Style Specification
CSSStyleDeclaration
Obsolete  

浏览器支持情况

We're converting our compatibility data into a machine-readable JSON format. This compatibility table still uses the old format, because we haven't yet converted the data it contains. Find out how you can help!

Feature Chrome Edge Firefox (Gecko) Internet Explorer Opera Safari (WebKit)
Basic support (Yes) (Yes) (Yes) (Yes) (Yes) (Yes)
Feature Android Edge Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile Chrome for Android
Basic support (Yes) (Yes) (Yes) (Yes) (Yes) (Yes) (Yes)

文档标签和贡献者

标签: 
 此页面的贡献者: Ende93, wanglin2
 最后编辑者: Ende93,