removeRule method (styleSheet)
Removes a rule from the current styleSheet object.
The rules collection represents the CSS rules excluding the at-rules, contained by a styleSheet object. The removeRule method removes the rule at the specified position from the rules collection.
In Firefox, Opera, Google Chrome, Safari and Internet Explorer from version 9, use the deleteRule method for similar functionality. It removes a CSSRule from the cssRules collection of a styleSheet object. The cssRules collection represents the CSS rules including the at-rules.To remove at-rules in older Internet Explorer versions, use the removeImport method for @import at-rules or modify the value of the cssText property for the others.
You can find the related objects in the Supported by objects section below.
|Optional. Zero-based integer that specifies the position of the style rule to remove in the rules collection.|
This method has no return value.
Example HTML code 1:
This example illustrates the use of the deleteRule and removeRule methods:
Did you find this example helpful?
User Contributed Comments