counters-010

Parsing counters() functions

WeasyPrint

This browser

Assertion
To refer to a sequence of nested counters of the same name, the notation is 'counters(identifier, string)' or 'counters(identifier, string, list-style-type)'.

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: Parsing counters() functions</title>
 5         <link rel="author" title="Microsoft" href="http://www.microsoft.com/">
 6         <link rel="help" href="http://www.w3.org/TR/CSS21/syndata.html#parsing-errors">
 7         <meta name="flags" content="">
 8         <meta name="assert" content="To refer to a sequence of nested counters of the same name, the notation is 'counters(identifier, string)' or 'counters(identifier, string, list-style-type)'.">
 9         <style type="text/css">
10             body
11             {
12                 counter-reset: chapter;
13             }
14             #p1
15             {
16                 counter-reset: chapter;
17             }
18             div p:before
19             {
20                 content: counter(chapter);
21                 counter-increment: chapter;
22             }
23             #p1:before
24             {
25                 content: counters(chapter, ".");
26                 counter-increment: chapter;
27             }
28             #p2:before
29             {
30                 content: counters(chapter, ".");
31                 counter-increment: chapter;
32             }
33             #p3:before
34             {
35                 content: counters(chapter, ".", lower-roman);
36                 counter-increment: chapter;
37             }
38             #p4:before
39             {
40                 content: counters(chapter, ".", upper-roman);
41                 counter-increment: chapter;
42             }
43         </style>
44     </head>
45     <body>
46         <p>Test passes if the equations below are true.</p>
47         <div>
48             <p> = 1</p>
49             <p id="p1"> = 1.1</p>
50             <p id="p2"> = 1.2</p>
51             <p id="p3"> = i.iii</p>
52             <p id="p4"> = I.IV</p>
53         </div>
54     </body>
55 </html>