Skip to content
Related Articles

Related Articles

CSSStyleDeclaration getPropertyPriority() Method
  • Difficulty Level : Basic
  • Last Updated : 10 Apr, 2019

The getPropertyPriority() method is used to check whether the specified CSS property has the priority set as “important” or not.



Parameters: It accepts a single parameter:

  • propertyname: It is a required parameter that contains a string which represents the name of the property to be checked.

Return Value: It returns the priority of the property in the form of the string. If it does not exist then it returns an empty string.

Example: To show the working of the getPropertyPriority() method:

        body {
            text-align: center;
        h1 {
            color: green;
        #p1 {
            color: green;
            font-size: 20 !important;
    <p id="p1">
      getPropertyPriority() Method
    <button onclick="myFunction()">
        Get property priority
    <p id="gfg"></p>
    <!-- Script to get the
       priority of the property -->
        function myFunction() {
            var x = 
            var prior = 
            document.getElementById("gfg").innerHTML =
                "Priority of font-size is " + prior;

Before clicking on the button:

After clicking on the button:

Supported Browsers:

  • Google Chrome
  • Internet Explorer 9.0
  • Firefox
  • Safari
  • Opera
My Personal Notes arrow_drop_up
Recommended Articles
Page :