<html>
<head>
<style>
h1 {
color: red;
font-size: 50px;
}
</style>
<script>
function myFunction() {
var s = document.styleSheets[0].rules[0].style;
var ruleObj = s.parentRule;
document.getElementById("demo").innerHTML = ruleObj.cssText;
}
</script>
</head>
<body>
<h1>The parentRule Property</h1>
<p>The parentRule property returns a CSSRule Object that represent the CSS rule for the specified style declaration.</p>
<button onclick="myFunction()">Display the CSS Rule</button>
<p id="demo"></p>
</body>
<!-- Mirrored from www.w3schools.com/jsref/tryit.asp?filename=tryjsref_cssstyle_parentrule by HTTrack Website Copier/3.x [XR&CO'2014], Mon, 27 Jan 2020 03:08:46 GMT -->
</html>