CSSStyleSheet: deleteRule() method
MDN Web Docs · نسخهٔ df622a2a1c1e · CC BY-SA 2.5 و مجوز جداگانهٔ ناشر برای نمونهکد
{{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
- CSS Object Model
- Constructable Stylesheets (web.dev)
- Using dynamic styling information
- {{domxref("CSSStyleSheet.insertRule", "insertRule()")}}