CSSStyleDeclaration removeProperty() 方法|移除指定的CSS样式

CSSStyleDeclaration 对象参考手册


定义与用法

removeProperty() 方法用于移除指定的 CSS 样式属性。


语法格式

object.removeProperty(propertyname)


示例代码

移除 color 属性:

var declaration = document.styleSheets[0].cssRules[0].style; 
var removedvalue = declaration.removeProperty("color"); 
alert(removedvalue);

亲自试试


浏览器支持

方法Google ChromeInternet ExplorerFirefoxSafariOpera
removeProperty()Yes9.0YesYesYes

属性值

参数描述
propertyname必需。一个字符串,表示要移除的属性名。

技术细节

DOM 版本:CSS Object Model
返回值:字符串, 是移除的属性名。

CSSStyleDeclaration 对象参考手册


相关