Gets the priority of a property in a CSS style declaration.
Method of css/cssom/CSSStyleDeclaration/CSSStyleDeclarationcss/cssom/CSSStyleDeclaration/CSSStyleDeclaration
Syntaxvar priority = declaration.getPropertyPriority(property);
Parameters property
The name of the CSS property.
Return ValueReturns an object of type StringString
A string that represents the priority if the property is explicitly set in this declaration block and has a specified priority specified, or null.
ExamplesGets the priority of the first rule in the stylesheet.
<head>
<style>
#aDiv {
width:200px !important;
}
</style>
<script type="text/javascript">
var rule = document.styleSheets[0].cssRules[0];
var priority = rule.style.getPropertyPriority ("width");
alert (priority);
</script>
</head>
<body>
<div id="aDiv">This is a div.</div>
</body>
Notes
The priority of a CSS property is designated by, for example, the !important declaration.
Related specificationsgetPropertyPriority
Reference
Microsoft Developer Network: [Windows Internet Explorer API reference Article]
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4