A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://developer.cdn.mozilla.net/en-US/docs/Web/API/CSSRule/parentRule below:

CSSRule: parentRule property - Web APIs

CSSRule: parentRule property

Baseline Widely available

The parentRule property of the CSSRule interface returns the containing rule of the current rule if this exists, or otherwise returns null.

Value

A CSSRule which is the type of the containing rules. If the current rule is inside a media query, this would return CSSMediaRule. Otherwise it returns null.

Examples
@media (width >= 500px) {
  .box {
    width: 100px;
    height: 200px;
    background-color: red;
  }

  body {
    color: blue;
  }
}
let myRules = document.styleSheets[0].cssRules;
let childRules = myRules[0].cssRules;
console.log(childRules[0].parentRule); // a CSSMediaRule
Specifications Browser compatibility

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4