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
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
Update compatibility data on GitHub
Desktop | Mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
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
HTMLStyleElement.type by Mozilla Contributors is licensed under CC-BY-SA 2.5.