Web/API/HTMLStyleElement/type

From Get docs


The HTMLStyleElement.type read-only property returns the type of the current style.

For Gecko, the type is most often given as "text/css." From the W3C spec on CSS: "The expectation is that binding-specific casting methods can be used to cast down from an instance of the CSSRule interface to the specific derived interface implied by the type."

Syntax

string = style.type;

Example

if (newStyle.type != "text/css"){
   // not supported!
   warnCSS();
}

Browser compatibility

Update compatibility data on GitHub

Desktop Mobile
Chrome Edge Firefox Internet Explorer Opera Safari Android webview Chrome for Android Firefox for Android Opera for Android Safari on iOS Samsung Internet
type Chrome

Full support 1

Edge

Full support 12

Firefox

Full support Yes

IE

Full support Yes

Opera

Full support ≤12.1

Safari

Full support Yes

WebView Android

Full support 1

Chrome Android

Full support 18

Firefox Android

Full support Yes

Opera Android

Full support ≤12.1

Safari iOS

Full support Yes

Samsung Internet Android

Full support 1.0

Legend

Full support  
Full support