content-counters-016.xht (1122B)
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() string argument</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 <style type="text/css"> 10 11 body { white-space: nowrap; } 12 13 14 body, #test { counter-reset: c; } 15 p, #test span { counter-increment: c; } 16 17 span#one:before { content: counters(c, ".") " - "; } 18 span#two:before { content: counters(c, "") " - "; } 19 span#three:before { content: counters(c, ".", decimal) "-- --" counters(c, "-------", decimal); } 20 21 </style> 22 </head> 23 <body> 24 25 <p>The following two lines should look the same:</p> 26 27 <div id="test"><span id="one"></span><span id="two"></span><span id="three"></span></div> 28 29 <div>1.1 - 12 - 1.3-- --1-------3</div> 30 31 </body> 32 </html>