2525
2626 < h1 > CSS Lists and Counters Module Level 3</ h1 >
2727
28- < h2 class ="no-num no-toc " id =longstatus-date > Editor's Draft 25 August 2012</ h2 >
28+ < h2 class ="no-num no-toc " id =longstatus-date > Editor's Draft 27 August 2012</ h2 >
2929
3030 < dl >
3131 < dt > This version:
3232
33- < dd > <!--<a href="http://www.w3.org/TR/2012/WD-css3-lists-20120825 ">http://www.w3.org/TR/2012/WD-css3-lists-20120825 </a>-->
33+ < dd > <!--<a href="http://www.w3.org/TR/2012/WD-css3-lists-20120827 ">http://www.w3.org/TR/2012/WD-css3-lists-20120827 </a>-->
3434 < a
3535 href ="http://dev.w3.org/csswg/css3-lists/ "> http://dev.w3.org/csswg/css3-lists/</ a >
3636
@@ -176,15 +176,22 @@ <h2 class="no-num no-toc" id=contents> Table of contents</h2>
176176 class =property > marker-side</ code > ’ property</ a >
177177 </ ul >
178178
179- < li > < a href ="#counter "> < span class =secno > 8. </ span > Automatic Counters and
180- Numbering: the ‘< code class =property > counter-increment</ code > ’,
181- ‘< code class =property > counter-set</ code > ’ and ‘< code
182- class =property > counter-reset</ code > ’ properties</ a >
179+ < li > < a href ="#counter "> < span class =secno > 8. </ span > Automatic Numbering
180+ With Counters</ a >
183181 < ul class =toc >
184- < li > < a href ="#nested-counters "> < span class =secno > 8.1. </ span > Nested
185- counters and scope</ a >
182+ < li > < a href ="#counter-properties "> < span class =secno > 8.1. </ span >
183+ Manipulating Counters: the ‘< code
184+ class =property > counter-increment</ code > ’, ‘< code
185+ class =property > counter-set</ code > ’ and ‘< code
186+ class =property > counter-reset</ code > ’ properties </ a >
186187
187- < li > < a href ="#counters-without-boxes "> < span class =secno > 8.2. </ span >
188+ < li > < a href ="#creating-counters "> < span class =secno > 8.2. </ span > Creating
189+ and Inheriting Counters</ a >
190+
191+ < li > < a href ="#nested-counters "> < span class =secno > 8.3. </ span > Nested
192+ Counters</ a >
193+
194+ < li > < a href ="#counters-without-boxes "> < span class =secno > 8.4. </ span >
188195 Counters in elements that do not generate boxes</ a >
189196 </ ul >
190197
@@ -1543,28 +1550,33 @@ <h3 id=marker-side><span class=secno>7.2. </span> The ‘<a
15431550 </ div >
15441551 <!-- ===================================================================== -->
15451552
1546- < h2 id =counter > < span class =secno > 8. </ span > Automatic Counters and
1547- Numbering: the ‘< a href ="#counter-increment "> < code
1548- class =property > counter-increment</ code > </ a > ’, ‘< a
1549- href ="#counter-set "> < code class =property > counter-set</ code > </ a > ’ and
1550- ‘< a href ="#counter-reset "> < code
1551- class =property > counter-reset</ code > </ a > ’ properties</ h2 >
1552-
1553- < p > A < dfn id =counter0 > counter</ dfn > is a special numeric object used,
1554- among other things, to automatically number list items in CSS.
1553+ < h2 id =counter > < span class =secno > 8. </ span > Automatic Numbering With
1554+ Counters</ h2 >
15551555
1556- < p > A < a href ="#counter0 "> < i > counter</ i > </ a > has an integer value and a < a
1557- href ="#scope "> < i > scope</ i > </ a > which dictates which elements share a given
1558- counter. The value of a < a href ="#counter0 "> < i > counter</ i > </ a > can be
1559- different on different elements in the document, allowing list items to
1560- generate successive numbers in their markers. They are created and
1556+ < p > A < dfn id =counter0 > counter</ dfn > is a special object used, among other
1557+ things, to automatically number list items in CSS. They are created and
15611558 manipulated with the ‘< a href ="#counter-increment "> < code
15621559 class =property > counter-increment</ code > </ a > ’, ‘< a
15631560 href ="#counter-set "> < code class =property > counter-set</ code > </ a > ’ and
15641561 ‘< a href ="#counter-reset "> < code
15651562 class =property > counter-reset</ code > </ a > ’ properties, and used with the
15661563 ‘< a href ="#counter0 "> < code class =css > counter()</ code > </ a > ’ and
1567- ‘< code class =css > counters()</ code > ’ functions.
1564+ ‘< code class =css > counters()</ code > ’ functions. Counters have an
1565+ integer value, a creator element, and possibly another counter nested
1566+ inside themselves.
1567+
1568+ < p > Each element has a collection of zero or more counters. Counters
1569+ inherit between elements in a way similar to other CSS values, but they
1570+ can inherit from previous siblings in addition to the normal behavior of
1571+ inheriting from parents. Counters can also "nest" inside of each other,
1572+ which makes it easier to number nested lists.
1573+
1574+ < h3 id =counter-properties > < span class =secno > 8.1. </ span > Manipulating
1575+ Counters: the ‘< a href ="#counter-increment "> < code
1576+ class =property > counter-increment</ code > </ a > ’, ‘< a
1577+ href ="#counter-set "> < code class =property > counter-set</ code > </ a > ’ and
1578+ ‘< a href ="#counter-reset "> < code
1579+ class =property > counter-reset</ code > </ a > ’ properties</ h3 >
15681580
15691581 < table class =propdef >
15701582 < tbody >
@@ -1610,25 +1622,24 @@ <h2 id=counter><span class=secno>8. </span> Automatic Counters and
16101622 </ table >
16111623
16121624 < p > The ‘< a href ="#counter-reset "> < code
1613- class =property > counter-reset</ code > </ a > ’ property creates new counters,
1614- with new associated < a href ="#scope "> < i > scopes </ i > </ a > . Its values are
1615- defined as follows:
1625+ class =property > counter-reset</ code > </ a > ’ property < a
1626+ href ="#create-a-new-counter "> < i title =" create a new counter " > creates new
1627+ counters </ i > </ a > on an element. Its values are defined as follows:
16161628
16171629 < dl >
16181630 < dt > none
16191631
1620- < dd > This element does not establish any new counters.
1632+ < dd > This element does not create any new counters.
16211633
16221634 < dt > < code > <ident> <integer> ?</ code >
16231635
1624- < dd > The element < a href ="#establishes-a-counter "> < i
1625- title ="establishes a counter "> establishes one or more new
1626- counters</ i > </ a > . Each < code > <ident> </ code > names a new counter which
1627- is created.
1636+ < dd > The element < a href ="#create-a-new-counter "> < i
1637+ title ="create a new counter "> creates one or more new counters</ i > </ a > .
1638+ Each < code > <ident> </ code > names a new counter to be created.
16281639 < p > If an < code > <integer> </ code > is provided after an
1629- < code > <ident> </ code > , the newly established counter's value is set to
1630- that integer.. Otherwise, the starting value of the new counter is
1631- ‘ < code class =css > 0</ code > ’.
1640+ < code > <ident> </ code > , the starting value of the new counter is that
1641+ integer. Otherwise, the starting value of the new counter is ‘ < code
1642+ class =css > 0</ code > ’.
16321643 </ dl >
16331644
16341645 < table class =propdef >
@@ -1734,20 +1745,20 @@ <h2 id=counter><span class=secno>8. </span> Automatic Counters and
17341745
17351746 < dd > The element alters the value of one or more counters on it. If there
17361747 is not currently a counter of the given name on the element, the element
1737- < a href ="#establishes-a-counter "> < i > establishes a counter</ i > </ a > of the
1738- given name and initally sets its value to ‘< code class =css > 0</ code > ’
1739- (though it may then immediately set or increment that value to something
1740- different).
1748+ < i > creates a new counter</ i > of the given name with a starting value of
1749+ ‘< code class =css > 0</ code > ’ (though it may then immediately set or
1750+ increment that value to something different).
17411751 < p > If an < code > <integer> </ code > is provided after an
1742- < code > <ident> </ code > , it sets the named counter to that integer (for
1743- ‘< a href ="#counter-set "> < code
1752+ < code > <ident> </ code > , it sets the innermost counter of the given name
1753+ to that integer (for ‘< a href ="#counter-set "> < code
17441754 class =property > counter-set</ code > </ a > ’) or increments the value of the
1745- named counter by that integer (for ‘< a href ="#counter-increment "> < code
1746- class =property > counter-increment</ code > </ a > ’). Otherwise, the
1747- counter's value is set to ‘< code class =css > 0</ code > ’ (for ‘< a
1748- href ="#counter-set "> < code class =property > counter-set</ code > </ a > ’) or
1749- incremented by ‘< code class =css > 1</ code > ’ (for ‘< a
1755+ innermost counter of the given name by that integer (for ‘< a
17501756 href ="#counter-increment "> < code
1757+ class =property > counter-increment</ code > </ a > ’). Otherwise, the
1758+ innermost counter of the given name's value is set to ‘< code
1759+ class =css > 0</ code > ’ (for ‘< a href ="#counter-set "> < code
1760+ class =property > counter-set</ code > </ a > ’) or incremented by ‘< code
1761+ class =css > 1</ code > ’ (for ‘< a href ="#counter-increment "> < code
17511762 class =property > counter-increment</ code > </ a > ’).
17521763 </ dl >
17531764
@@ -1767,9 +1778,9 @@ <h2 id=counter><span class=secno>8. </span> Automatic Counters and
17671778}</ pre >
17681779 </ div >
17691780
1770- < p > Resetting a counter must be done < em > before</ em > setting a counter,
1771- which must be done < em > before</ em > incrementing a counter , which must be
1772- done < em > before</ em > using a counter (for example, in the ‘< code
1781+ < p > Resetting counters must be done < em > before</ em > setting counters, which
1782+ must be done < em > before</ em > incrementing counters , which must be done
1783+ < em > before</ em > using counters (for example, in the ‘< code
17731784 class =property > content</ code > ’ property).
17741785
17751786 < div class =note >
@@ -1795,40 +1806,52 @@ <h2 id=counter><span class=secno>8. </span> Automatic Counters and
17951806 class =property > counter-increment</ code > </ a > ’ properties.
17961807 </ div >
17971808
1798- < h3 id =nested-counters > < span class =secno > 8.1. </ span > Nested counters and
1799- scope</ h3 >
1800-
1801- < p > Every < a href ="#counter0 "> < i > counter</ i > </ a > is associated with a < dfn
1802- id =scope title ="scope|scopes "> scope</ dfn > , which defines which elements in
1803- the document share a given counter.
1804-
1805- < p > < a href ="#scope "> < i > Scopes</ i > </ a > have a name, which is the same as
1806- their associated counter, a root element, which is the element that
1807- establishes the counter, and a set of contained elements, which are the
1808- elements that share the given counter. When an element < dfn
1809- id =establishes-a-counter > establishes a counter</ dfn > , it creates a counter
1810- and scope of the given name, sets the scope's root element to the element
1811- that establishes it, and sets the contained elements to the element and
1812- its descendants, all following siblings of the root element up to but not
1813- including the first sibling that establishes a counter of the same name,
1814- and all descendants of those siblings.
1815-
1816- < p > The value of a counter can change across its scope. Whenever an element
1817- sets the value of a counter, the altered value is what is seen by all
1818- elements contained in the scope that are later in document order (unless,
1819- of course, another element between the two further alters the counter's
1820- value).
1821-
1822- < p > Counters are "self-nesting"; establishing a counter in an element
1823- already contained in the scope of another counter of the same name simply
1824- creates a new instance of the counter. This is important for situations
1825- like lists in HTML, where lists can be nested inside lists to arbitrary
1826- depth. It would be impossible to define uniquely named counters for each
1827- level. As explained in a later section, the ‘< a href ="#counter0 "> < code
1828- class =css > counter()</ code > </ a > ’ function only uses the innermost counter
1829- of a given name on the element, but the ‘< code
1830- class =css > counters()</ code > ’ function uses all counters of a given name
1831- that contain the element.
1809+ < h3 id =creating-counters > < span class =secno > 8.2. </ span > Creating and
1810+ Inheriting Counters</ h3 >
1811+
1812+ < p > Every element has a (possibly empty) set of counters. Like many other
1813+ CSS values, an element can inherit counters from another element. Unlike
1814+ many other CSS values, elements can inherit counters from their previous
1815+ sibling as well as their parent.
1816+
1817+ < p > If an element has a previous sibling, it inherits all of the sibling's
1818+ counters (both those the sibling inherited, and ones the sibling created).
1819+ Otherwise, if an element has a parent, it inherits all of the parent's
1820+ counters. Otherwise, the element starts with an empty set of counters.
1821+
1822+ < p > Elements can create additional counters on themselves, which can then
1823+ be passed onto siblings or children. To < dfn
1824+ id =create-a-new-counter > create a new counter</ dfn > , specify an element
1825+ that's creating it, a name, and a starting value. The effect depends on
1826+ what other counters of that name exist on the element:
1827+
1828+ < ul >
1829+ < li > If no counters of that name exist on the element, create a new
1830+ counter with that name on the element.
1831+
1832+ < li > Otherwise, if a counter of the name exists on the element, and it was
1833+ created by a preceding sibling, replace the innermost counter of that
1834+ name on the element with a newly-created counter with that name.
1835+
1836+ < li > Otherwise, create a new counter with that name and nest it inside of
1837+ the innermost counter with that name.
1838+ </ ul >
1839+
1840+ < p > Regardless, the value of the new counter is set to the provided
1841+ starting value.
1842+
1843+ < h3 id =nested-counters > < span class =secno > 8.3. </ span > Nested Counters</ h3 >
1844+
1845+ < p > Counters are "self-nesting"; < a href ="#create-a-new-counter "> < i
1846+ title ="create a new counter "> creating a new counter</ i > </ a > in an element
1847+ which already has a counter with the same name simply creates a new
1848+ counter of the same name, nested inside the existing counter. This is
1849+ important for situations like lists in HTML, where lists can be nested
1850+ inside lists to arbitrary depth. It would be impossible to define uniquely
1851+ named counters for each level. As explained in a later section, the
1852+ ‘counter()’ function only uses the innermost counter of a given name
1853+ on the element, but the ‘counters()’ function uses all counters of a
1854+ given name that contain the element.
18321855
18331856 < div class =example >
18341857 < p > Thus, the following suffices to number nested list items. The result
@@ -1877,7 +1900,7 @@ <h3 id=nested-counters><span class=secno>8.1. </span> Nested counters and
18771900 visually.
18781901 </ div >
18791902
1880- < h3 id =counters-without-boxes > < span class =secno > 8.2 . </ span > Counters in
1903+ < h3 id =counters-without-boxes > < span class =secno > 8.4 . </ span > Counters in
18811904 elements that do not generate boxes</ h3 >
18821905
18831906 < p > An element that does not generate a box (for example, an element with
@@ -3673,7 +3696,7 @@ <h2 class=no-num id=index>Index</h2>
36733696 title ="<counter-function> "> < strong > 9.</ strong > </ a >
36743697
36753698 < li > counter-increment, < a href ="#counter-increment "
3676- title =counter-increment > < strong > 8.</ strong > </ a >
3699+ title =counter-increment > < strong > 8.1. </ strong > </ a >
36773700
36783701 < li > counter-name, < a href ="#name "
36793702 title =counter-name > < strong > 10.</ strong > </ a >
@@ -3688,10 +3711,10 @@ <h2 class=no-num id=index>Index</h2>
36883711 title =counter-range > < strong > 10.</ strong > </ a >
36893712
36903713 < li > counter-reset, < a href ="#counter-reset "
3691- title =counter-reset > < strong > 8.</ strong > </ a >
3714+ title =counter-reset > < strong > 8.1. </ strong > </ a >
36923715
36933716 < li > counter-set, < a href ="#counter-set "
3694- title =counter-set > < strong > 8.</ strong > </ a >
3717+ title =counter-set > < strong > 8.1. </ strong > </ a >
36953718
36963719 < li > <counters-function> , < a href ="#ltcounters-function "
36973720 title ="<counters-function> "> < strong > 9.</ strong > </ a >
@@ -3708,6 +3731,9 @@ <h2 class=no-num id=index>Index</h2>
37083731 < li > counter symbol, < a href ="#counter-symbol "
37093732 title ="counter symbol "> < strong > 10.7.</ strong > </ a >
37103733
3734+ < li > create a new counter, < a href ="#create-a-new-counter "
3735+ title ="create a new counter "> < strong > 8.2.</ strong > </ a >
3736+
37113737 < li > CSSCounterStyleRule, < a href ="#csscounterstylerule "
37123738 title =CSSCounterStyleRule > < strong > 13.2.</ strong > </ a >
37133739
@@ -3729,9 +3755,6 @@ <h2 class=no-num id=index>Index</h2>
37293755
37303756 < li > disc, < a href ="#disc " title =disc > < strong > 12.</ strong > </ a >
37313757
3732- < li > establishes a counter, < a href ="#establishes-a-counter "
3733- title ="establishes a counter "> < strong > 8.1.</ strong > </ a >
3734-
37353758 < li > fallback, < a href ="#descdef-fallback "
37363759 title =fallback > < strong > 10.6.</ strong > </ a >
37373760
@@ -3819,10 +3842,6 @@ <h2 class=no-num id=index>Index</h2>
38193842 < li > range, < a href ="#descdef-range " title =range > < strong > 10.5.</ strong > </ a >
38203843
38213844
3822- < li > scope, < a href ="#scope " title =scope > < strong > 8.1.</ strong > </ a >
3823-
3824- < li > scopes, < a href ="#scope " title =scopes > < strong > 8.1.</ strong > </ a >
3825-
38263845 < li > square, < a href ="#square " title =square > < strong > 12.</ strong > </ a >
38273846
38283847 < li > <string> , < a href ="#list-style-type-string "
0 commit comments