content-counters-006.xht (1397B)
1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> 2 <html xmlns="http://www.w3.org/1999/xhtml"> 3 <head> 4 <title>CSS Test: content: counters(c, ".", decimal-leading-zero)</title> 5 <link rel="author" title="L. David Baron" href="https://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 <meta http-equiv="Content-Style-Type" content="text/css"/> 10 <style type="text/css"> 11 12 body { white-space: nowrap; } 13 14 15 body, #test span:first-child { counter-reset: c; } 16 p, #test span { counter-increment: c; } 17 #test span:before { content: counters(c, ".", decimal-leading-zero); } 18 19 </style> 20 </head> 21 <body> 22 23 <p>The following two lines should look the same:</p> 24 25 <div id="test"> 26 <span></span> 27 <span></span> 28 <span></span> 29 <span></span> 30 <span></span> 31 <span></span> 32 <span></span> 33 <span></span> 34 <span></span> 35 <span></span> 36 <span></span> 37 <span></span> 38 <span style="counter-reset: c 98"></span> 39 <span></span> 40 <span></span> 41 </div> 42 43 <div> 44 01.01 45 01.02 46 01.03 47 01.04 48 01.05 49 01.06 50 01.07 51 01.08 52 01.09 53 01.10 54 01.11 55 01.12 56 01.99 57 01.100 58 01.101 59 </div> 60 61 </body> 62 </html>