rulesrules*
*



Contents  *



Index  *Topic Contents
*Previous Topic: rows
*Next Topic: scripts

rules

Description

Retrieves a collection of rules that are defined in the style sheet. This collection is always accessible, and can be accessed even if the style sheet is not enabled. Rules are added and removed from the rules collection with add and remove methods on the individual style sheet. A rule that is added to a disabled style sheet will not apply to the document unless the style sheet's disabled property is changed to false.

The rules in this collection are in the source order of the document. Style rules linked in using the "@import" syntax of CSS should be expanded in-place in this collection according to the CSS1 specification.

As rules are added or deleted through the Cascading Style Sheets Object Model, a rule's absolute position in the rules collection might change, but its position relative to other rules will remain the same. The default location to add a new rule (without specifying an index) is at the end of the collection, which is the highest precedence (not accounting for selector specificity, as according to the CSS specification) and is applied to the document last. If an index is supplied, the rule should be inserted before the rule currently in that ordinal position in the collection, or, if the index is larger than the number of rules in the collection, it should be added to the end.

Syntax

object.rules(index)

ParameterDescription
(index) Optional. An integer or a string specifying the index value of the element to retrieve. Integer indexes are zero-based, meaning the first element in the collection has index 0. A string index is valid only if the string is an identifier of at least one element in the document.

Property

length

Applies To

styleSheet


Up Top of Page
© 1997 Microsoft Corporation. All rights reserved. Terms of Use.