asp.net.ph

Skip Navigation Links

rules Collection

DHTML Collections


DOM Level 2 Specification.

Retrieves the list of all CSS rules contained within the style sheet.

Syntax


[ collRules = ] stylesheet.rules
[ oObject = ] stylesheet.rules ( iIndex )

Possible Values


collRules Reference to an array of elements contained by the object.
oObject Reference to an individual item in the array of elements contained by the object.
iIndex Integer indicating the item to be returned.

Members



Remarks

This interface provides the abstraction of an ordered collection of CSS rules that are defined in the style sheet. This includes both rule sets and @ rules.

This collection is always accessible even if the style sheet is not enabled. Rules are added to the rules collection with the addRule method 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 is enabled. Rules are deleted with the removeRule method.

The rules in this collection are in the source order of the document. 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, per 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.

Applies To

styleSheet



© 2025 Reynald Nuñez and asp.net.ph. All rights reserved.

If you have any question, comment or suggestion
about this site, please send us a note