<!DOCTYPE html>
<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>
</html>