counters-scope-002

Counter scope and nesting on :before

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: Counter scope and nesting on :before</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#scope">
 7   <link rel="help" href="http://www.w3.org/TR/CSS21/generate.html#counters">
 8   <link rel="help" href="http://www.w3.org/TR/CSS21/generate.html#propdef-content">
 9   <link rel="help" href="http://www.w3.org/TR/CSS21/syndata.html#counter">
10   <style type="text/css">
11 
12   body { white-space: nowrap; }
13 
14 
15   span:before { counter-increment: c 1; content: "B" counters(c,".") "-" }
16   span:after  { counter-increment: c 1; content: "A" counters(c,".") "-" }
17 
18   body, span#reset:before { counter-reset: c 0; }
19 
20   </style>
21  </head>
22  <body>
23 
24  <p>The following two lines should be the same:</p>
25 
26  <div><span><span id="reset"><span></span></span></span></div>
27  <div>B1-B1.1-B1.2-A1.3-A1.4-A2-</div>
28 
29  </body>
30 </html>