0 out of 5 rated this helpful - Rate this topic

rule object

Represents a style within a style sheet that consists of a selector and one or more declarations.

Members

The rule object has these types of members:

Properties

The rule object has these properties.

PropertyDescription

constructor

Returns a reference to the constructor of an object.

cssText

Sets or retrieves the persisted representation of the style rule.

parentRule

Retrieves the containing rule, if the current rule is contained inside another rule.

parentStyleSheet

Retrieves the style sheet that contains the current rule.

readOnly

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

selectorText

Retrieves a string that identifies which elements the corresponding style sheet rule applies to.

type

Retrieves the type of the rule.

 

Standards information

There are no standards that apply here.

Remarks

The rule object defines a set of Cascading Style Sheets (CSS) attributes applied to a set of HTML elements. For example, a rule consisting of the selector H1 and the declaration font-family:Arial defines all H1 elements to render in the Arial font.

This object is available in script as of Microsoft Internet Explorer 5.

Examples

This example uses a rule object consisting of the selector H1 to define a single rule that changes the H1 headings in a document to red.


<STYLE>
    H1 { color: red }
</STYLE>

If the style sheet containing the preceding rule is the first style sheet in the document, the following code returns the rule object associated with the rule.


oRule=document.styleSheets(0).rules(0)

See also

rules

 

 

Send comments about this topic to Microsoft

Build date: 11/29/2012

Did you find this helpful?
(1500 characters remaining)

Community Additions

ADD
© 2013 Microsoft. All rights reserved.