A RetroSearch Logo

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

Search Query:

Showing content from http://developer.mozilla.org/en-US/docs/Web/API/CSSGroupingRule/insertRule below:

CSSGroupingRule: insertRule() method - Web APIs

CSSGroupingRule: insertRule() method

Baseline Widely available

The insertRule() method of the CSSGroupingRule interface adds a new CSS rule to a list of CSS rules.

Syntax
insertRule(rule)
insertRule(rule, index)
Parameters
rule

A string

index Optional

An optional index at which to insert the rule; defaults to 0.

Return value

The index of the new rule.

Exceptions
IndexSizeError DOMException

Thrown if index is greater than the number of child CSS rules.

HierarchyRequestError DOMException

Thrown if rule cannot be inserted at the specified index due to some CSS constraint.

HierarchyRequestError DOMException

Thrown if the rule is a valid statement but not a nested statement.

Examples
let myRules = document.styleSheets[0].cssRules;
myRules[0].insertRule(
  "html {background-color: blue;}",
  0,
); /* inserts a rule for the HTML element at position 0 */
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