XMetaL Tips and Tricks
Derek Read October 31, 2008 at 9:32 pm
CSS: Understanding Cascading Rules for "counter-reset"October 31, 2008 at 9:32 pmParticipants 1Replies 0Last Activity 13 years, 11 months ago
XMetaL Author 2.0+ and XMAX 4.0+
XMetaL Author uses standard W3C CSS “cascading rules” so becoming familar with those rules will help greatly when designing complex CSS files for displaying XML documents in XMetaL Author and XMAX. However, these rules can be fairly complicated and can be confusing when it comes to counters and numbering, particularly when it comes to the counter-reset property.
- The CSS referred to here is that which affects TagsOn view and Normal view (the two main editing views) only.
- The “!important” CSS keyword is not recognized by XMetaL Author and XMAX but all other CSS2 cascading rules are.
Suppose you have set two different counters in your CSS and you want them both to be reset whenever an element called
is encountered in the document.
A style sheet containing the following will only reset the counter called “imagenum”:
In this first case the second counter-reset property (imagenum) simply overrides the first one (section) because only the last property in any given selector is used.
A style sheet containing the following will also only reset the counter called “imagenum”:
In this second case, duplicate properties in the second selector override those in the previous selector because the second selector is just as specific (but not more specific) as the first one.
To reset both counters they must be specified together within the same selector and on the same counter-reset property:
counter-reset: section imagenum
- W3C CSS2 (12.5 Automatic counters and numbering): http://www.w3.org/TR/REC-CSS2/generate.html#propdef-counter-reset
- W3C CSS2 (6 Assigning property values, Cascading, and Inheritance): http://www.w3.org/TR/REC-CSS2/cascade.html
- You must be logged in to reply to this topic.