All Tech Tips

rule Object

Represents a style within a Cascading Style Sheets (CSS) that consists of a selector and one or more declarations.

Members Table

PropertyDescription
readOnly Retrieves whether the rule or style sheet is defined on the page or is imported.
selectorText Retrieves a string that identifies which elements the corresponding style sheet rule applies to.
ObjectDescription
style Represents the current settings of all possible inline styles for a given element.

Remarks

The rule object defines a set of 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 heading(s) 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)

Standards Information

There is no public standard that applies to this object.

See Also

rules


Copyright © 2006 alltechtips.com. All rights reserved.

This website and the materials and information you find on this website are provided "as is", without warranty of any kind, either express or implied, including without limitation any warranty for information, services, or products provided through or in connection with the service and any implied warranties of merchantability, fitness for a particular purpose, expectation of privacy or non-infringement.