page-counters-000.xht (1349B)
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: margin box referencing document counters</title> 5 <link rel="author" title="Tom Clancy" href="mailto:tclancy@revenution.com"/> 6 <link rel="author" title="Hewlett-Packard Company" href="http://www.hp.com/"/> 7 <link rel="help" href="http://www.w3.org/TR/css3-page/#populating-margin-boxes"/> 8 <meta name="flags" content="paged" /> 9 <meta name="assert" content="The value of the counter at the beginning of page processing must be used by default. "/> 10 <style type="text/css"><![CDATA[ 11 body {counter-reset: chapter;} 12 div.chapter {counter-increment: chapter;} 13 @page { 14 @top-center { content: "Chapter " counter(chapter); } 15 } 16 div.section {page-break-before: always;} 17 ]]></style> 18 </head> 19 <body> 20 <div class="chapter">This paragaraph should appear on the first page, which should say "Chapter 0" at the top. A second page with "Chapter 4" at the top should also print.</div> 21 <div class="chapter"></div> 22 <div class="chapter"></div> 23 24 <div class="section chapter">This paragaraph should appear on the second page, which should say "Chapter 4" at the top.</div> 25 <div class="chapter"></div> 26 <div class="chapter"></div> 27 </body> 28 </html>