counters-scope-004.xht (1152B)
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: Counter scope and nesting</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#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 .reset { counter-reset: c; } 16 .rb:before { counter-reset: c; content: "R"; } 17 .use { counter-increment: c; } 18 .use:before { content: counters(c, ".") " "; } 19 20 </style> 21 </head> 22 <body> 23 24 <p>The next two lines should be the same:</p> 25 26 <div><span class="reset"></span><span class="use"></span><span class="reset"></span><span class="use"></span><span class="rb"><span class="use"></span><span class="reset"></span><span class="use"></span></span></div> 27 <div>1 1 R1.1 1.1</div> 28 29 </body> 30 </html>