counters-order-000

Order of 'counter-reset', 'counter-increment', and counter use, including pseudo-elements

WeasyPrint

This browser

Source

 1 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
 2 <html>
 3  <head>
 4   <title>CSS Test: Order of 'counter-reset', 'counter-increment', and counter use, including pseudo-elements</title>
 5   <link rel="author" title="L. David Baron" href="http://dbaron.org/">
 6   <link rel="help" href="http://www.w3.org/TR/CSS21/generate.html#counters">
 7   <link rel="help" href="http://www.w3.org/TR/CSS21/generate.html#propdef-content">
 8   <link rel="help" href="http://www.w3.org/TR/CSS21/syndata.html#counter">
 9   <style type="text/css">
10 
11   body { white-space: nowrap; }
12 
13 
14   span.c span:before { content: counter(c); }
15   span.c { counter-reset: c 0; }
16   span.one { counter-reset: c 1; }
17   span.two { counter-increment: c 2; }
18   span.four:before { counter-reset: c 4; }
19   span.eight:before { counter-increment: c 8; }
20   span.c span:after { counter-increment: c 100; counter-reset: c 200; }
21 
22   </style>
23  </head>
24  <body>
25 
26  <p>The following should be identical:</p>
27 
28  <div>
29    <span class="c"><span class=""></span></span>
30    <span class="c"><span class="one"></span></span>
31    <span class="c"><span class="two"></span></span>
32    <span class="c"><span class="two one"></span></span>
33    <span class="c"><span class="four"></span></span>
34    <span class="c"><span class="four one"></span></span>
35    <span class="c"><span class="four two"></span></span>
36    <span class="c"><span class="four two one"></span></span>
37    <span class="c"><span class="eight"></span></span>
38    <span class="c"><span class="eight one"></span></span>
39    <span class="c"><span class="eight two"></span></span>
40    <span class="c"><span class="eight two one"></span></span>
41    <span class="c"><span class="eight four"></span></span>
42    <span class="c"><span class="eight four one"></span></span>
43    <span class="c"><span class="eight four two"></span></span>
44    <span class="c"><span class="eight four two one"></span></span>
45  </div>
46 
47  <div>
48    0
49    1
50    2
51    3
52    4
53    4
54    4
55    4
56    8
57    9
58    10
59    11
60    12
61    12
62    12
63    12
64  </div>
65 
66  </body>
67 </html>