CSSStyleDeclaration getPropertyPriority() method

Definition and Usage

getPropertyPriority() Method returns whether the specified CSS property has an "important!" priority setting.

If this method returns "important!", an important qualifier is set.

If this method returns an empty string, no important qualifier is set.

Example

Return whether the color attribute has an "important!" priority setting:

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

try it personally

grammar

object.getPropertyPriority(propertyname)

参数

参数 描述
propertyname 必需。字符串,表示要检查的属性的名称。

技术细节

DOM 版本: CSS Object Model
返回值: 表示优先级的字符串,如果不存在则为空字符串。

浏览器支持

Chrome Edge Firefox Safari Opera
Chrome Edge Firefox Safari Opera
支持 9.0 支持 支持 支持