Compartilhar via


IHTMLStyleSheet interface

This interface provides access to an object that represents a single style sheet in the document.

Members

The IHTMLStyleSheet interface inherits from the IDispatch interface. IHTMLStyleSheet also has these types of members:

  • Methods
  • Properties

Methods

The IHTMLStyleSheet interface has these methods.

Method Description
addImport

Adds a style sheet to the imports collection for the specified style sheet.

addRule

Creates a new rule for a style sheet.

removeImport

Removes the imported style sheet from the imports collection based on ordinal position.

removeRule

Deletes an existing style rule for the styleSheet object, and adjusts the index of the rules collection accordingly.

 

Properties

The IHTMLStyleSheet interface has these properties.

Property Access type Description

cssText

Read/write

Sets or retrieves the persisted representation of the style rule.

disabled

Sets or retrieves a value that indicates whether the user can interact with the object.

href

Sets or retrieves the URL of the linked style sheet.

id

Sets or retrieves the string identifying the object.

media

Sets or retrieves the media type.

owningElement

Retrieves the next object in the HTML hierarchy.

parentStyleSheet

Retrieves the style sheet that imported the current style sheets.

readOnly

Retrieves whether the rule or style sheet is defined on the document or is imported.

title

Sets or retrieves the title of the style sheet.

type

Retrieves the CSS language in which the style sheet is written.

 

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 defines the style sheet. You can then use the style sheet object to modify the document's style sheet.

You can retrieve a pointer to the style sheet object using the IHTMLDocument2::styleSheets method. You can also retrieve a collection of all IHTMLStyleSheetsCollection in the document using the IHTMLStyleSheet::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.

Requirements

Minimum supported client

Windows XP

Minimum supported server

Windows 2000 Server

Header

Mshtml.h

IDL

Mshtml.idl

DLL

Mshtml.dll

See also

IDispatch