Back to Content

CSSStyleSheet: deleteRule() method

files/en-us/web/api/cssstylesheet/deleterule/index.md

latest878 B
Original Source

{{APIRef("CSSOM")}}

The {{domxref("CSSStyleSheet")}} method deleteRule() removes a rule from the stylesheet object.

Syntax

js-nolint
deleteRule(index)

Parameters

  • index
    • : The index into the stylesheet's {{domxref("CSSRuleList")}} indicating the rule to be removed.

Return value

None ({{jsxref("undefined")}}).

Examples

This example removes the first rule from the stylesheet myStyles.

js
myStyles.deleteRule(0);

Specifications

{{Specifications}}

Browser compatibility

{{Compat}}

See also