content-counters-017

content: counters() string argument

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: content: counters() string argument</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#propdef-content">
 7   <link rel="help" href="http://www.w3.org/TR/CSS21/syndata.html#counter">
 8   <link rel="help" href="http://www.w3.org/TR/CSS21/generate.html#counter-styles">
 9   <style type="text/css">
10 
11   body { white-space: nowrap; }
12 
13 
14   body, #test { counter-reset: c; }
15   div, :before, :after { white-space: pre; }
16   p, #test span { counter-increment: c; }
17 
18   span#one:before { content: counters(c, ".") " - "; }
19   span#two:before { content: counters(c, "") " - "; }
20   span#three:before { content: counters(c, ".", decimal) "--       --" counters(c, "-------", decimal); }
21 
22   </style>
23  </head>
24  <body>
25 
26  <p>The following two lines should look the same:</p>
27 
28  <div id="test"><span id="one"></span><span id="two"></span><span id="three"></span></div>
29 
30  <div>1.1 - 12 - 1.3--       --1-------3</div>
31 
32  </body>
33 </html>