Skip to content
Related Articles

Related Articles

CSSStyleDeclaration parentRule Property

View Discussion
Improve Article
Save Article
  • Last Updated : 15 Jul, 2022

The parentRule property is used to return the CSSRule Object that represents a CSS rule-set that contains selector and declaration block

Syntax: It is used to return the parentRule property.


Return Value: It returns the CSSRule object. 

Example: To return the parentRule property


        CSS | Style Declaration parentRule Property
        body {
            text-align: center;
        h1 {
            color: green;
        #p1 {
            color: green;
            font-size: 20;
    <p id="p1">
      parentRule Property
      Click the button to
      return the parentRule property
    <button onclick="myFunction()">
        Get parentRule
    <p id="gfg"></p>
    <!-- Script to get parentRule property -->
        function myFunction() {
            var x =
            document.getElementById("gfg").innerHTML = x;


  • Before clicking on the button:


  • After clicking on the button:


Supported Browsers: The browsers supported by Style Declaration parentRule Property are listed below:

  • Google Chrome 1
  • Edge 12
  • Internet Explorer 9
  • Firefox 1
  • Opera 15
  • Safari 1

My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!