IHTMLStyleSheet::addRule method

[This documentation is preliminary and is subject to change.]

Creates a new rule for a style sheet.

Syntax

Integer* addRule(
  [in]            BSTR sSelector,
  [in]            BSTR sStyle,
  [in, optional]  Integer iIndex = -1
);

Parameters

sSelector [in]

BSTR that specifies the selector for the new rule. Single contextual selectors are valid. For example, "div p b" is a valid contextual selector.

sStyle [in]

BSTR that specifies the style assignments for this style rule. This style takes the same form as an inline style specification. For example, "color:blue" is a valid style parameter.

iIndex [in, optional]

long that specifies the zero-based position in the rules collection where the new style rule should be placed.

-1

Default. The rule is added to the end of the collection.

Return value

Reserved. long that always specifies -1.

Remarks

You can add up to 4095 style rules with the addRule method. After that, the method returns E_INVALIDARG.

You can apply rules to a disabled styleSheet, but they do not apply to the document until you enable the styleSheet.

Requirements

Minimum supported client

Windows XP

Minimum supported server

Windows 2000 Server

Header

DLL

Mshtml.dll

See also

IHTMLStyleSheet

Reference

removeRule

rules

styleSheets

 

 

Build date: 1/23/2012