CSSStyleSheet.deleteRule()

The CSSStyleSheet method deleteRule() removes a rule from the stylesheet object.

Syntax

cssStyleSheet.deleteRule(index)

Parameters

index
The index into the stylesheet's CSSRuleList indicating the rule to be removed.

Return value

undefined

Example

This example removes the first rule from the stylesheet myStyles.

 myStyles.deleteRule(0);

Specifications

Specification Status Comment
CSS Object Model (CSSOM)
The definition of 'CSSStyleSheet.deleteRule()' in that specification.
Working Draft

Browser compatibility

DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internet
deleteRule()Chrome Full support YesEdge Full support 12Firefox Full support 1IE Full support 9Opera Full support YesSafari Full support YesWebView Android Full support YesChrome Android Full support YesFirefox Android Full support 4Opera Android Full support YesSafari iOS Full support YesSamsung Internet Android Full support Yes

Legend

Full support
Full support

See also