Packagedom.style.stylesheets
Classpublic class StyleSheet
InheritanceStyleSheet Inheritance Object
Subclasses CSSStyleSheet

Introduced in: DOM 2 Core 

The StyleSheet interface is the abstract base interface for any type of style sheet. It represents a single style sheet associated with a structured document. In HTML, the StyleSheet interface represents either an external style sheet, included via the HTML LINK element, or an inline STYLE element. In XML, this interface represents an external style sheet, included via a style sheet processing instruction.

All browser compatibility information was obtained via Quirksmode.

See also

MSDN: StyleSheet
MDC - stylesheet
W3C - DOM Level 2 Style: StyleSheet


Public Properties
 PropertyDefined By
  DOM 2 Style disabled : Boolean
[read-only] This property indicates whether the current stylesheet is applied or not.
StyleSheet
  DOM 2 Style href : DOMString
[read-only] If the style sheet is a linked style sheet, the value of its attribute is its location.
StyleSheet
  DOM 2 Style media : DOMString
Specifies the intended destination medium for style information.
StyleSheet
  DOM 2 Style ownerNode : Node
[read-only] The node that associates this style sheet with the document.
StyleSheet
  DOM 2 Style parentStyleSheet : StyleSheet
[read-only] For style sheet languages that support the concept of style sheet inclusion, this attribute represents the including style sheet, if one exists.
StyleSheet
  DOM 2 Style title : DOMString
[read-only] The advisory title.
StyleSheet
  DOM 2 Style type : DOMString
[read-only] This specifies the style sheet language for this style sheet.
StyleSheet
Property Detail
DOM 2 Style disabledproperty
disabled:Boolean  [read-only]

Product Versions : Internet Explorer 5.5 Internet Explorer 6.0 Internet Explorer 7.0 Internet Explorer 8.0 as IE7 Internet Explorer 8.0 as IE8 Firefox 2.0 Firefox 3.0 Firefox 3.5 Safari 3.0 Safari 3.1 Safari 4.0 Chrome 1.0 Chrome 2.0 Opera 9.62 Opera 10.0b
Introduced in: DOM 2 Core 

This property indicates whether the current stylesheet is applied or not.


Implementation
    public function get disabled():Boolean

See also


Example
         // if the stylesheet is disabled... 
         if (stylesheet.disabled) {
             // apply style in-line 
         }
DOM 2 Style hrefproperty 
href:DOMString  [read-only]

Product Versions : Internet Explorer 5.5 Internet Explorer 6.0 Internet Explorer 7.0 Internet Explorer 8.0 as IE7 Internet Explorer 8.0 as IE8 Firefox 2.0 Firefox 3.0 Firefox 3.5 Safari 3.0 Safari 3.1 Safari 4.0 Chrome 1.0 Chrome 2.0 Opera 9.62 Opera 10.0b
Introduced in: DOM 2 Core 

If the style sheet is a linked style sheet, the value of its attribute is its location. For inline style sheets, the value of this attribute is null.


Implementation
    public function get href():DOMString

See also


Example
         // on a local machine: 
         <html> 
             <head> 
                 <link rel="StyleSheet" href="example.css" type="text/css" /> 
                 <script> 
                     function sref() { 
                         alert(document.styleSheets[0].href); 
                     }
                 </script> 
             </head> 
             <body> 
                 <div class="thunder">Thunder</div>
         
                 <button onclick="sref()">ss</button>
             </body> 
         </html>
         // returns "file:////C:/Windows/Desktop/example.css
DOM 2 Style mediaproperty 
media:DOMString

Introduced in: DOM 1 Core 

Specifies the intended destination medium for style information. DOM 1 Spec

A string describing a single medium or a comma-separated list.

DOM Level 2 Style Spec

The intended destination media for style information. The media is often specified in the ownerNode. If no media has been specified, the MediaList will be empty.

Note: According to DOM Level 2 Style specification, the Media property is supposed to be Read-Only and return an instance of the MediaList object. Most browsers handle this property as it was specified in DOM Level 1.

Note: Acceptable values are as listed:

The default value is "screen" for Firefox and "all" for Internet Explorer.


Implementation
    public function get media():DOMString
    public function set media(value:DOMString):void

See also

DOM 2 Style ownerNodeproperty 
ownerNode:Node  [read-only]

Product Versions : Internet Explorer 5.5 Internet Explorer 6.0 Internet Explorer 7.0 Internet Explorer 8.0 as IE7 Internet Explorer 8.0 as IE8 Firefox 2.0 Firefox 3.0 Firefox 3.5 Safari 3.0 Safari 3.1 Safari 4.0 Chrome 1.0 Chrome 2.0 Opera 9.62 Opera 10.0b
Introduced in: DOM 2 Core 

The node that associates this style sheet with the document. For HTML, this may be the corresponding LINK or STYLE element. For XML, it may be the linking processing instruction. For style sheets that are included by other style sheets, the value of this attribute is null.


Implementation
    public function get ownerNode():Node

See also


Example
         <html>
             <head>
                 <link rel="StyleSheet" href="example.css" type="text/css" />
                 <script>
                     function stilo() {
                         alert(document.styleSheets[0].ownerNode);
                     }
                 </script> 
             </head>
         
             <body> 
                 <div class="thunder">Thunder</div>
         
                 <button onclick="sref()">ss</button>
             </body> 
             // displays "object HTMLLinkElement"
         </html>
DOM 2 Style parentStyleSheetproperty 
parentStyleSheet:StyleSheet  [read-only]

Product Versions : Internet Explorer 5.5 Internet Explorer 6.0 Internet Explorer 7.0 Internet Explorer 8.0 as IE7 Internet Explorer 8.0 as IE8 Firefox 2.0 Firefox 3.0 Firefox 3.5 Safari 3.0 Safari 3.1 Safari 4.0 Chrome 1.0 Chrome 2.0 Opera 9.62 Opera 10.0b
Introduced in: DOM 2 Core 

For style sheet languages that support the concept of style sheet inclusion, this attribute represents the including style sheet, if one exists. If the style sheet is a top-level style sheet, or the style sheet language does not support inclusion, the value of this attribute is null.


Implementation
    public function get parentStyleSheet():StyleSheet

See also


Example
         // find the top level stylesheet
         if (stylesheet.parentStyleSheet) {
             sheet = stylesheet.parentStyleSheet;
         } else {
             sheet = stylesheet;
         }
DOM 2 Style titleproperty 
title:DOMString  [read-only]

Introduced in: DOM 2 Core 

The advisory title.

Note: The title is often specified in the ownerNode.


Implementation
    public function get title():DOMString

See also

DOM 2 Style typeproperty 
type:DOMString  [read-only]

Introduced in: DOM 2 Core 

This specifies the style sheet language for this style sheet. The style sheet language is specified as a content type. The content type is often specified in the ownerNode.


Implementation
    public function get type():DOMString

See also


Example
ss.type = "text/css";