The CSSStyleSheet.deleteRule() method removes a style rule from the current style sheet object.
Syntax
stylesheet.deleteRule(index)
Parameters
indexis a long number representing the position of the rule.
Return value
Void.
Example
myStyles.deleteRule(0);
Specifications
| Specification | Status | Comment |
|---|---|---|
| CSS Object Model (CSSOM) The definition of 'CSSStyleSheet.deleteRule()' in that specification. |
Working Draft | |
| Document Object Model (DOM) Level 2 Style Specification The definition of 'CSSStyleSheet.deleteRule()' in that specification. |
Recommendation | Initial definition |
Browser compatibility
| Feature | Chrome | Edge | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
|---|---|---|---|---|---|---|
| Basic support | (Yes) | (Yes) | (Yes) | 9.0 | (Yes) | (Yes) |
| Feature | Android | Edge | Firefox Mobile (Gecko) | IE Phone | Opera Mobile | Safari Mobile |
|---|---|---|---|---|---|---|
| Basic support | (Yes) | (Yes) | (Yes) | (Yes) | (Yes) | (Yes) |
Legacy browser support
-
Internet Explorer - pre v9
removeRule([index]); -- Example:removeRule(); // remove first rule
Also note the non-standardaddRule()and.rulesinstead ofinsertRule()and.cssRulesrespectively.
See also
Document Tags and Contributors
Tags:
Contributors to this page:
erikadoyle,
pcat,
Sebastianz,
fscholz,
teoli,
ethertank,
Sheppy,
jliu,
Ptak82,
Dria,
JesseW
Last updated by:
erikadoyle,