@media (width >= 500px) {
.box {
width: 100px;
height: 200px;
background-color: red;
}
body {
color: blue;
}
}CSSRule: parentRule property / notebook
CSSRule: parentRule property
Runnable notebook: every JavaScript, HTML and CSS example on this page executes in a sandboxed local frame. Nothing leaves the browser.
let myRules = document.styleSheets[0].cssRules;
let childRules = myRules[0].cssRules;
console.log(childRules[0].parentRule); // a CSSMediaRule