Creates a new rule for a style sheet.
HRESULT addRule( BSTR bstrSelector, BSTR bstrStyle, long lIndex, long *plNewIndex );
- [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.
- [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.
- [in] long that specifies the zero-based position in the rules collection where the new style rule should be placed.
- Default. The rule is added to the end of the collection.
- [out, retval] Reserved. long that always specifies
Returns S_OK if successful, or an error value otherwise.
You can add up to 4095 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.