You are here: Reference > JavaScript > client-side > style handling > properties > type (styleSheet)

type property (styleSheet)

Browser support:
Retrieves a string value that identifies the language (MIME type) in which the styleSheet is written.
The MIME type for a style sheet can be specified with the type property of a style element, or with the type property of a link element.


You can find the related objects in the Supported by objects section below.
This property is read-only.

Possible values:

String that represents the language.
Default: this property has no default value.

Example HTML code 1:

This example illustrates the use of the type property:
    <style id="myStyle" type="text/css">
        button {
            background-color: cyan;
            border: solid 1px blue;
    <script type="text/javascript">
        function GetStyleSheetType () {
            var styleTag = document.getElementById ("myStyle");

                // the style sheet in the style tag
            var sheet = styleTag.sheet ? styleTag.sheet : styleTag.styleSheet;

            alert (sheet.type);
    <button onclick="GetStyleSheetType ()">Get the MIME type of a styleSheet!</button>
Did you find this example helpful? yes no

Supported by objects:

Related pages:

External links:

User Contributed Comments

Post Content

Post Content