Export (0) Print
Expand All
0 out of 1 rated this helpful - Rate this topic

IHTMLStyleSheet::addRule method

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 strong" 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 4,095 style rules with the IHTMLStyleSheet::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 [desktop apps only]

Minimum supported server

Windows 2000 Server [desktop apps only]

Header

Mshtml.h

IDL

Mshtml.idl

DLL

Mshtml.dll

See also

IHTMLStyleSheet
Reference
IHTMLStyleSheet::removeRule
rules
styleSheets

 

 

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.