The IHTMLStyleSheet interface provides access to an object representing a single style sheet in the document.
IHTMLStyleSheet Methods
addImport Adds a style sheet to the imports collection for the given style sheet. addRule Creates a new style rule using the given selector and style assignment. get_cssText Retrieves a string of the rules defined in the cascading style sheets (CSS). get_disabled Retrieves the value that indicates whether the style sheet has a title and is currently enabled. get_href Retrieves the URL of a linked style sheet. get_id Retrieves the identifier of the style sheet. get_imports Retrieves a zero-based collection of all the imported style sheets defined for the given IHTMLStyleSheet object. An imported style sheet is one that is brought into the document using the cascading style sheets (CSS) @import attribute. get_media Receives the string that indicates which media this style applies to. get_owningElement Retrieves the element that is next in the HTML hierarchy. This usually contains the STYLE or LINK that defined the style sheet. get_parentStyleSheet Retrieves an interface pointer to the IHTMLStyleSheet object that imported the current style sheet. This property is intended for imported styleSheets. get_readOnly Retrieves the value that indicates whether the rule object can be edited. get_rules Retrieves an IHTMLStyleSheetRulesCollection pointer to the collection of the rules in this IHTMLStyleSheet. If there are no rules, the length of the collection returned is zero. get_title Retrieves the title of the IHTMLStyleSheet. get_type Retrieves the cascading style sheets (CSS) language that the style sheet is written in. put_disabled Enables or disables the style sheet. put_href Sets the URL of a linked IHTMLStyleSheet; that is, it is part of a LINK element. put_media Sets the string that indicates which media this style element applies to. For details, see the IHTMLLinkElement::put_media method for values. put_title Sets the title of the IHTMLStyleSheet element. removeImport Removes the imported style sheet by ordinal position in the imports collection based on the value of the index passed in. removeRule Removes the rule by ordinal position based on the value of the index passed in. The rule is deleted from the style sheet, and the document is updated to reflect any changes.
Interface Information
Implementation System (Mshtml.dll) Inherits from IDispatch Header and IDL files Mshtml.h, Mshtml.idl Minimum availability Internet Explorer 4.0 Minimum operating systems Windows 95, Windows NT 4.0
Windows CE
Windows CE Use version 2.12 and later Minimum availability Internet Explorer 4.0
Remarks
The style sheet object is used to retrieve information about a style sheet. For example, you can use it to retrieve the URL of a style sheet's source file, and to retrieve the element in the document that owns (defines) the style sheet. You then can use it to modify the document's style sheet.
You can retrieve a pointer to the style sheet object using the IHTMLDocument2::get_styleSheets method. You also can retrieve a collection of all styleSheets in the document using the IHTMLStyleSheet::get_imports method. Each item in the collection is a style sheet. A style sheet object is available for a style sheet only if it is included in a document with a STYLE or LINK element, or with an @import statement in the STYLE element.