Mon, 25 Feb 2013 01:11:04 +0100
[css3-page] Deduplicate and clarify Page Properties and related appendix.
1 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
2 <html lang="en">
3 <head>
4 <title>
5 CSS Paged Media Module Level 3
6 </title>
7 <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
8 <link href="../default.css" rel="stylesheet" type="text/css">
9 <link rel="stylesheet" type="text/css" href="http://www.w3.org/StyleSheets/TR/W3C-ED.css">
10 <style type="text/css">
11 .keyword { font-weight:bold }
12 .equation { padding: 2% }
13 table.equation {text-align:center}
14 td, th { vertical-align: top }
15 pre { font-size: 1em; }
17 #margin-values { border-collapse: collapse; }
18 #margin-values td,
19 #margin-values th
20 {
21 padding: 0.2em;
22 border: thin solid black;
23 }
25 .property-list
26 {
27 border: 1px solid black;
28 padding: .2em;
29 margin-top: 2em;
30 }
32 .property-list td
33 {
34 border: 1px solid black;
35 padding: .1em;
36 }
38 .editorial
39 {
40 display: block;
41 font-family: arial, helvetica, sans-serif;
42 font-size: 80%;
43 margin-left: .5in;
44 margin-right: 1in ;
45 padding: 0.125in;
46 background: #FFFFDD ;
47 }
49 .editorial:after { content: "Ed."}
50 .RFC2119
51 {
52 text-transform: lowercase;
53 font-style: italic
54 }
56 em em.RFC2119
57 {
58 text-transform: lowercase;
59 font-style: normal
60 }
62 table.page-sizes
63 {
64 border: thin solid;
65 margin-top: 1.5em;
66 }
67 table.page-sizes td
68 {
69 border: thin solid;
70 padding: .5em;
71 }
72 table.page-sizes th
73 {
74 border: thin solid;
75 padding: .5em;
76 background: #ffffaa;
77 }
79 </style>
80 </head>
81 <body class="h-entry">
82 <div>
83 <div class="head">
84 <!--logo-->
85 <h1 class="p-name">CSS Paged Media Module Level 3</h1>
86 <h2 class="no-num no-toc" id="w3c-working">[LONGSTATUS] <span class="dt-updated"><span class="value-title" title="[CDATE]">[DATE]</span></span></h2>
87 <dl>
88 <dt>This version:</dt> <dd><a class="u-url" href="http://dev.w3.org/csswg/css3-page/">http://dev.w3.org/csswg/css3-page/</a></dd>
89 <!-- <dd><a class="u-url" href="[VERSION]">http://www.w3.org/TR/[YEAR]/WD-[SHORTNAME]-[CDATE]</a></dd> -->
90 <dt>Latest version:</dt> <dd><a href="http://www.w3.org/TR/css3-page">http://www.w3.org/TR/css3-page</a></dd>
91 <dt>Previous version:</dt> <dd><a rel="previous" href="http://www.w3.org/TR/2006/WD-css3-page-20061010/">http://www.w3.org/TR/2006/WD-css3-page-20061010/</a></dd>
92 <dt>Issue Tracking:</dt>
93 <dd><a rel="issues" href="http://www.w3.org/Style/CSS/Tracker/products/13">http://www.w3.org/Style/CSS/Tracker/products/13</a>
94 <!-- or use the wiki:
95 <dd><a rel="issues" href="http://wiki.csswg.org/spec/css3-page"
96 >http://wiki.csswg.org/spec/css3-page</a></dd>
97 -->
98 <dt>Feedback:</dt>
99 <dd><a href="mailto:www-style@w3.org?subject=%5B[SHORTNAME]%5D%20feedback"
100 >www-style@w3.org</a>
101 with subject line “<kbd>[[SHORTNAME]]
102 <var>… message topic …</var></kbd>”
103 (<a rel="discussion" href="http://lists.w3.org/Archives/Public/www-style/"
104 >archives</a>)
106 <dt>Editors:</dt>
107 <dd class="p-author h-card vcard">
108 <span class="p-name fn">Melinda Grant</span>,
109 <span class="p-org org">Hewlett-Packard</span></dd>
110 <dd class="p-author h-card vcard">
111 <span class="p-name fn">Håkon Wium Lie</span>,
112 <span class="p-org org">Opera Software</span></dd>
113 <dd class="p-author h-card vcard">
114 <span class="p-name fn">Elika J. Etemad</span>,
115 <span class="p-org org">Mozilla</span></dd>
116 <dd class="p-author h-card vcard">
117 <span class="p-name fn">Simon Sapin</span>,
118 <span class="p-org org">Kozea</span></dd>
119 </dl>
121 <!--copyright-->
123 </div>
124 <hr title="Separator for header">
126 <h2 class="no-num no-toc" id="abstract">Abstract</h2>
128 <p>
129 <span class="p-summary">
130 This module describes the page model that partitions a flow into pages. It
131 builds on the <a href="http://www.w3.org/TR/CSS21/box.html">Box model module</a> and introduces
132 and defines the page model and paged media. It adds functionality for
133 pagination, page margins, page size and orientation, headers and footers,
134 widows and orphans, and image orientation. Finally it extends generated content
135 to enable page numbering and running headers / footers. </span>
136 </p>
138 <!-- "Status of this document" -->
140 <h2 class="no-num no-toc" id="status">Status of this Document</h2>
142 <!--status-->
144 <p>This document contains the <abbr title="Cascading Style Sheets">CSS3</abbr>
145 Paged Media Module W3C Last Call <a href="/2005/10/Process-20051014/tr.html#RecsWD">Working Draft</a> of [DATE]. The
146 Last Call period ends on <span class="fudge">TBD</span>.</p>
148 <p>Expected next revision to this document is another LCWD, due to the
149 substantive changes to page-margin box sizing and other areas that are now
150 specified with more precision.</p>
152 <p>The <a href="lc2_issues.htm">Disposition of Comments</a>
153 document contains the current issues list and responses to input received
154 during this Last Call period.</p>
156 <h2 class="no-num no-toc" id="contents">Table of Contents</h2><!--begin-toc-->
157 <!--end-toc-->
158 <!-- "Introduction" -->
159 <h2 id="intro">Introduction</h2>
161 <p>Paged media (e.g., paper, transparencies, photo album pages, pages
162 displayed on computer screens as printed output simulations) differ from
163 <a href="http://www.w3.org/TR/CSS2/media.html#continuous-media-group">continuous media</a>
164 in that the content of the document is split into one or more discrete
165 static display surfaces. To handle pages, CSS3 Paged Media describes how:</p>
167 <ul>
168 <li><a href="#page-breaks">page breaks</a> are created and avoided;</li>
169 <li>the page properties such as size, orientation, margins, border, and
170 padding are specified;</li>
171 <li>headers and footers are established within the page margins;</li>
172 <li>content such as page counters are placed in the headers and footers; and</li>
173 <li>orphans and widows can be controlled.</li>
174 </ul>
176 <p>This module defines a <a href="#page-model">page model</a> that specifies how a
177 document is formatted within a rectangular area, called the
178 <a href="#page-box-page-rule">page box</a>, that has finite width and height.
180 <p>Although CSS3 does not specify how user agents transfer page boxes to sheets,
181 it does include certain mechanisms for telling user agents about the intended
182 page sheet <a href="#page-size">size and orientation</a>. In the general case,
183 CSS3 assumes that one page box will be transferred to one surface of similar
184 size.</p>
186 <p>All properties defined in this specification also accept the
187 <a href="http://www.w3.org/TR/CSS21/cascade.html#value-def-inherit">inherit</a>
188 keyword as their value, but for readability it has not been listed explicitly.
190 <h2 id="conformance">Conformance</h2>
192 <p>All of the text in this specification is normative except sections
193 explicitly marked as non-normative, examples, and notes. The keywords
194 "<em class="RFC2119">MUST</em>", "<em class="RFC2119">SHALL</em>",
195 "<em class="RFC2119">MUST NOT</em>", "<em class="RFC2119">SHALL NOT</em>",
196 "<em class="RFC2119">REQUIRED</em>", "<em class="RFC2119">SHOULD</em>",
197 "<em class="RFC2119">SHOULD NOT</em>", "<em class="RFC2119">RECOMMENDED</em>",
198 "<em class="RFC2119">MAY</em>", and "<em class="RFC2119">OPTIONAL</em>" when
199 used in this document are to be interpreted as described in <cite>RFC
200 2119</cite> [[!RFC2119]]. However, for readability, these words do not appear
201 in all uppercase letters in this specification.</p>
203 <p>Examples in this specification are introduced with the words "for example"
204 or are set apart from the normative text with <code>class="example"</code>,
205 like this:
207 <div class="example">
208 <p>This is an example of an informative example.</p>
209 </div>
211 <p>Informative notes begin with the word "Note" and are set apart from the
212 normative text with <code>class="note"</code>, like this:
214 <p class="note">Note, this is an informative note.</p>
216 <h2 id="page-terms">Page Terminology</h2>
218 <p>The following terminology and accompanying diagrams help to describe the
219 page model:</p>
221 <dl>
222 <dt id="page-sheet">Page sheet</dt>
223 <dd><img src="PageSheet.png" style="float: right;" alt="The corner of a page sheet with the non-printable area at the edge and printable area inside it"
224 height="148" width="194">The page sheet is one surface of the physical
225 medium. The illustration to the right shows a representation of the upper-left
226 corner of a page sheet.</dd>
228 <dt id="printable-area">Printable and non-printable areas</dt>
229 <dd>The non-printable area is the area of a page sheet that a physical device such
230 as a printer is not capable of marking reliably, usually due to the printer's
231 paper handling mechanism. This value is printer dependent and is usually a
232 small region along each edge of the page sheet. The printable area is the area
233 of page sheet that a printer <em>is</em> capable of marking reliably. The size
234 of the printable area is the size of the page sheet reduced by the size of the
235 non-printable area. A user agent may not know the dimensions of this area for a
236 particular printing device; but when its dimensions are known, user agents
237 <em class="RFC2119">MAY</em> adjust the formatting of the document so that
238 content falls within the printable area. How this adjustment is accomplished is
239 device dependent within the constraints expressed in the sections
240 <a href="#renderingpages">Rendering page boxes that do not fit a page sheet</a> and
241 <a href="#content-outside-box">Content outside the page box</a>.</dd>
243 <dt id="page-orientation">Page Orientation</dt>
244 <dd>The page orientation is defined by comparing the length of the edges of a
245 <a href="#page-box">page box</a>. The page box is a rectangle with two
246 perpendicular edges called the long edge and the short edge. The length of the
247 long edge is always greater than or equal to the length of the short edge. When
248 the page box is square, the two edges are of the same length and either can be
249 used as the long edge with the other being the short edge. This specification
250 defines page orientations of 'portrait' and 'landscape'.</dd>
252 <dt id="portrait">Portrait Orientation</dt>
253 <dd>A portrait page's height is greater than or equal to its width. Horizontal
254 elements are parallel to the short edge and vertical elements to the long edge.</dd>
256 <dt id="landscape">Landscape Orientation</dt>
257 <dd>A landscape page's width is greater than or equal to its height. Horizontal
258 elements are parallel to the long edge and vertical elements to the short edge.
259 <span class="note">Note that CSS3 makes no distinction between landscape and
260 reverse-landscape orientations. However, future versions of CSS may do so.
261 UAs should consider, when formatting for duplexed printing, the binding edge,
262 page progression, and ease of reading when choosing between landscape and
263 reverse-landscape renderings.</span>
264 </dd>
266 <dt id="duplex-printing">Duplex Printing</dt>
267 <dd>Duplex printing prints one page box per side of a page sheet and uses both
268 sides of the page sheet. This module provides no ability to specify whether a
269 document is duplex printed, but the concept of left and right pages is based on
270 the assumption that the document is duplex printed, regardless of whether or
271 not it actually is.</dd>
273 <dt id="binding-edge">Binding Edge</dt>
274 <dd>The binding edge is the edge of the page box that is toward the binding if the
275 material is bound. The binding edge often has a larger margin than the opposite
276 edge to provide for the space used by the binding. The binding edge can be any
277 of the four edges. However, page sheets are customarily bound so that the
278 binding edge of page boxes with portrait orientation is vertical. This module
279 provides no method to specify the binding edge. In duplex printing, the binding
280 edge is on opposite sides of the page box for the left and right pages.</dd>
282 <dt id="facing-pages">Facing Pages</dt>
283 <dd>Facing pages are two sequential pages such that when the document is duplex
284 printed they are on separate sheets of paper. Typically, the earlier page will
285 be the back side of one sheet and the later page will be the front side of
286 another. They are usually laid out so that the binding edges of facing pages
287 are vertical and adjacent when the pages are placed in their normal reading
288 orientation.</dd>
290 <dt id="left-page">Left Page</dt>
291 <dd>A page that would be on the left if it is part of a pair of facing pages as
292 typically laid out. Page layouts for documents using a left-to-right page
293 progression have the earlier of the facing pages on the left. Rules specific to
294 the left page can be specified using the <span class="css">':left'</span>
295 <i>page selector</i>.
296 </dd>
298 <dt id="right-page">Right Page</dt>
299 <dd>A page that would be on the right if it is part of a pair of facing pages as
300 typically laid out. Page layouts for documents using a right-to-left page
301 progression have the earlier of the facing pages on the right. Rules specific
302 to the right page can be specified using the <span class="css">':right'</span>
303 <i>page selector</i>.
304 </dd>
305 </dl>
308 <h2 id="page-box-page-rule">The Page Model</h2>
310 <p>In the paged media formatting model, the document is transferred into one
311 or more page boxes. The <dfn id="page-box">page box</dfn> is a specialized CSS
312 box that maps to a rectangular print media surface, such as a page of paper.
313 It is roughly analogous to the <a href="http://www.w3.org/TR/CSS21/visuren.html#viewport">viewport</a>.
314 <img src="PageBox.png" style="float: right;" alt="" height="266" width="267">
316 <p>As with other CSS <a href="http://www.w3.org/TR/CSS21/box.html">boxes</a>, a page box
317 consists of margin, border, padding, and content areas. The content and
318 margin areas of a page box have special functions:</p>
320 <ul>
321 <li>The content area of a page box is called the <dfn id="page-area">page
322 area</dfn>. The content of the document is flowed into one or more page boxes.
323 The page area acts as a container for all the boxes generated by the root
324 element and its descendants that are laid out within a given page box. The
325 edges of the page area on the first page establish the rectangle that is the
326 initial <a href="http://www.w3.org/TR/CSS21/visudet.html#containing-block-details">containing block</a>
327 of the document.</li>
328 <li>The margin area of a page box is divided into
329 16 <dfn>page-margin boxes</dfn>.
330 Each page-margin box has its own margin, border, padding and content areas.
331 Page-margin boxes are typically used to display running headers and footers.</li>
332 </ul>
334 <p>The properties of a <i>page box</i> are determined by properties
335 <a href="http://www.w3.org/TR/CSS21/syndata.html#declaration">declared</a> within the
336 <i>page context</i>, which is the
337 <a href="http://www.w3.org/TR/CSS21/syndata.html#x14">declaration block</a> of the
338 <code>@page</code> rule. Similarly the properties of a <i>page-margin box</i>
339 are determined by properties declared within its <i>margin context</i>.
340 Declarations in the page context can affect the page box and/or inherit
341 to the page-margin boxes, but they do not apply to or inherit into the
342 document's root element or other content.</p>
344 <p>The <i>containing block</i> of the page box is specified using the 'size'
345 property in the <i>page context</i>. The width and horizontal margins
346 of the page box are then calculated exactly as for a
347 <a href="http://www.w3.org/TR/CSS21/visudet.html#blockwidth">non-replaced
348 block element in normal flow</a>. [[!CSS21]] The height and vertical margins
349 of the page box are calculated analogously (instead of using the block height
350 formulas). In both cases if the values are over-constrained, instead of
351 ignoring any margins, the containing block is resized to coincide with the
352 margin edges of the page box.
354 <h3 id="painting">
355 Page Backgrounds and Painting Order</h3>
357 <p>When drawing a page of content, the page layers are painted in the
358 following painting order (bottommost first):
360 <ol>
361 <li>page background
362 <li>document canvas
363 <li>page borders
364 <li>document contents
365 <li>page-margin boxes
366 </ol>
368 <p>In the page model, the page background behaves similar to the root background:
369 its <a href="http://www.w3.org/TR/css3-background/#background-painting-area"><i>background painting area</i></a>
370 is the entire page box, including its margins (regardless of 'background-clip').
371 Page backgrounds are anchored within the page box's padding area by default
372 (and honor 'background-origin' if the UA supports [[!CSS3BG]]).
373 However if 'background-attachment' is ''fixed''
374 then the image is positioned relative to the page box including its margins
375 (i.e. the <a href="http://www.w3.org/TR/css3-background/#background-positioning-area"><i>background positioning area</i></a>,
376 like the <i>background painting area</i>, is the page's margin box).
378 <p>The document canvas background is drawn as the page box's background:
379 by default its <i>background painting area</i> covers the page box's border box,
380 and for UAs that support [[!CSS3BG]], follows the 'background-clip' value specified on the root element.
381 It remains, however, positioned with respect to the root element
382 or page area as usual.
384 <p>The UA may support the <code>z-index</code> property for page-margin boxes.
385 With respect to the page-margin boxes,
386 the document canvas, page borders, and all of the document contents
387 are treated as a single element with a <code>z-index</code> value of '0':
388 the page-margin boxes never interleave with parts of the document content
389 or between the content and the canvas.
390 They may only paint in front of the document content or behind the document canvas.
391 The page background is always painted underneath everything else.
392 Since the <code>position</code> property does not apply to page-margin boxes,
393 <code>z-index</code> always affects page-margin boxes
394 as if they were positioned elements
395 regardless of the <code>position</code> property's value.
397 <p>The default painting order,
398 or <a href="http://www.w3.org/TR/CSS21/zindex.html">CSS2.1 Appendix E</a> "tree order",
399 of page-margin boxes with respect to each other is not specified.
400 However, the page-margin boxes are defined to come
401 after the page box and its contents.
402 <span class="issue">Suggestions here are welcome.</span>
404 <h3 id="content-outside-box">Content outside the page box</h3>
406 <p>When formatting content in the page model, some content may end up outside the
407 page box. For example, an element whose 'white-space' property has the value
408 'pre' can generate a box that is wider than the page box. As another example,
409 when boxes are positioned absolutely or relatively, they may end up in
410 "inconvenient" locations. For example, images may be placed on the edge of
411 the page box or 100,000 meters below the page box. </p>
413 <p>A specification for the exact formatting of such elements lies outside the
414 scope of this document. However, it is recommended that authors and user agents
415 observe the following general principles concerning content outside the page
416 box:</p>
418 <ul>
419 <li><p>Content should be allowed slightly beyond the page box to allow pages
420 to "bleed".
421 <li><p>User agents <em class="RFC2119">SHOULD</em> avoid generating a large
422 number of content-empty pages to honor the positioning of elements (e.g.,
423 printing 100 blank pages is probably neither the author's nor the user's
424 intent).
425 A <dfn id="content-empty">Content-empty page</dfn> is a page box whose page
426 area contains no printable content other than backgrounds and/or borders. A
427 page box whose page area contains generated content, or content whose
428 visibility is 'hidden', or invisible content such as a zero-width space is
429 not a content-empty page. On the other hand, a page containing only a
430 background and/or borders and/or page-margin box content <em>is</em> a
431 content-empty page.
432 <p class="note">Note, however, that generating a small number of empty page
433 boxes is sometimes necessary to honor the <span class="css">'left'</span> and
434 <span class="css">'right'</span> values for <span class="property">'break-before'</span>
435 and <span class="property">'break-after'</span>.</li>
437 <li><p>Authors <em class="RFC2119">SHOULD NOT</em> position elements in
438 inconvenient locations just to avoid rendering them. Instead:
439 <ul>
440 <li>To suppress box generation entirely, set the <span class="property">'display'</span> property to <span class="css">'none'</span>.</li>
441 <li>To make a box invisible, set the <span class="property">'visibility'</span>
442 property.</li>
443 </ul></li>
444 <li><p>This specification does not define how boxes positioned outside the page
445 box are handled. Possibilities include discarding them or creating page boxes
446 for them at the end of the document.</li>
447 </ul>
449 <h3 id="progression">Page Progression</h3>
451 <p>CSS distinguishes between left pages and right pages on all documents,
452 whether they are printed duplex or not. Each left page is followed by a
453 right page and vice versa. Left and right pages can be styled differently
454 with the <a href="#left-right-first"><code>:left</code> and <code>:right</code>
455 pseudo-classes</a>.
457 <p>Whether the first page of a document is a left page or a right page
458 depends on the page progression of the document. The <dfn>page progression</dfn>
459 is the direction in which the printed pages of a document would be sequenced
460 when laid out side-to-side. For example, English and horizontally-set Japanese
461 typically progress from left to right, whereas Arabic and vertically-set
462 Japanese pages typically progress from right to left. In documents with
463 a left-to-right page progression the first page of the document is a right
464 page, and vice versa.</p>
466 <p>The page progression direction is determined as follows:</p>
468 <ul>
469 <li>If text is laid out in horizontal lines, the page progression is the
470 same as the inline progression.</li>
471 <li>If text is laid out in vertical lines, the page progression is the
472 same as the block progression.</li>
473 </ul>
475 <p>If the UA supports the 'direction' and 'writing-mode' properties
476 from the CSS 3 Writing Modes Module [[CSS3-WRITING-MODES]], it must
477 <a href="http://www.w3.org/TR/css3-writing-modes/#page-direction">determine</a>
478 whether the first page is a left or right page from the values of those
479 properties on the root element.</p>
481 <p>
482 To explicitly force a document to begin printing on a left or right page,
483 authors can specify a <a href="http://www.w3.org/TR/css3-break/#break-before">'break-before'</a> value
484 that that propagates a page break to the root. [[!CSS3-BREAK]]
485 The UA must suppress the first (empty) page(s) in this case
486 (and the <code>:first</code> pseudo-class matches the first printed page).
488 <div class="example">
489 <pre>
490 html { break-before: always }
491 </pre>
493 <p>
494 For an HTML document with a left-to-right page progression,
495 the above style rule will cause the first page of the document
496 to print on a ':left' page
497 </p>
499 <pre>
500 html { break-before: left }
501 </pre>
503 <p>
504 For an HTML document,
505 the above style rule will cause the first page of the document
506 to print on a ':left' page,
507 regardless of the page progression.
508 </p>
509 </div>
511 <h2 id="page-selector-and-context">Page Selectors and the Page Context</h2>
513 <h3 id="at-page-rule">The @page Rule</h3>
515 <p>Authors can specify various aspects of a page box, such as its dimensions,
516 orientation, and margins, within an <span class="css">@page</span> rule.
517 ''@page'' rules are allowed at the top-level of a stylesheet,
518 as well as wherever
519 <a href="http://www.w3.org/TR/CSS21/syndata.html#rule-sets">rule-sets</a>
520 are allowed.
521 An <span class="css">@page</span> rule consists of
522 the keyword <span class="css">'@page'</span>,
523 an <em class="RFC2119">OPTIONAL</em> comma-separated list of
524 <a href="#page-selectors">page selectors</a>
525 and a block of declarations
526 (said to be in the <dfn id="page-context">page context</dfn>).
527 An ''@page'' rule can also contain other at-rules,
528 interleaved between declarations.
529 The current level of this specification
530 only allows <a href="#margin-at-rules">margin at-rules</a> inside ''@page''.
532 <p>''@page'' rules without a selector list
533 are considered to have a single, empty selector.
534 ''@page'' rules apply to pages that <i>match</i>
535 at least one of their selectors.
537 <p>Properties declared within the page context apply to the page box.
539 <p>If an error is encountered during the processing of a declaration block within
540 a page or a margin context, the <a href="http://www.w3.org/TR/CSS21/syndata.html#parsing-errors">Rules for handling parsing errors</a>
541 apply; that is, valid declarations within the block are applied.</p>
544 <h3 id="page-selectors">Page selectors</h3>
546 <p>A <dfn id="page-selector">page selector</dfn> is either:
548 <ul>
549 <li>one or more
550 <a href="http://www.w3.org/TR/CSS21/syndata.html#characters">ASCII case-insensitive</a>
551 <a href="#pseudo-classes">pseudo-classes</a>,
552 <li>a <a href="#using-named-pages">page type</a>
553 (a case-sensitive identifier)
554 followed by zero or more pseudo-classes.
555 </ul>
557 <p>
558 No whitespace is allowed between components of a selector.
559 The <i title="page_selector">page selector grammar</i>
560 and examples can be found below.
562 <p>A selector is said to <dfn>match</dfn> a given page if and only if
563 all of its components match the page.
564 Empty selectors (ie. ''@page'' rules without a selector) match every page.
565 <span class="note">Empty selectors have the weakest <i>specificity</i>.</span>
567 <p><a href="#using-named-pages">Page type</a> selectors <i>match</i>
568 pages of the named type generated by the 'page' property.
569 <span id="page-selector-syntax-restrict">
570 A page type name of ''auto''
571 (<a href="http://www.w3.org/TR/CSS21/syndata.html#characters">ASCII case-insensitive</a>)
572 does not make the rule invalid,
573 but <em class="RFC2119">MUST</em> never match.
574 </span>
575 Individual <a href="#pseudo-classes">pseudo-classes</a> are defined below.
577 <h4 id="pseudo-classes">
578 <a id="left-right-first"></a>
579 Page pseudo-classes: :left, :right, :first, and :blank
580 </h4>
582 <p>
583 When printing double-sided documents,
584 left and right pages are often formatted differently.
585 This can be expressed through CSS pseudo-classes defined
586 in the <a href="#page-context">page context</a>.
588 <p>
589 All pages are automatically classified by user agents
590 as either left pages or right pages,
591 based on <a href="#progression">page progression</a>.
592 The '':left'' and '':right'' pseudo-classes only <i>match</i>
593 left or right pages, respectively.
595 <div class="example">
596 The following example creates left and right binding edges using these pseudo-classes:
597 <pre>
598 @page :left {
599 margin-left: 3cm;
600 margin-right: 4cm;
601 }
603 @page :right {
604 margin-left: 4cm;
605 margin-right: 3cm;
606 }
607 </pre>
608 </div>
610 <p>If different declarations have been given for left and right pages, the user
611 agent <em class="RFC2119">MUST</em> honor these declarations even if the user
612 agent does not transfer the page boxes to left and right sheets (i.e., a
613 printer that only prints on one side of the medium must nevertheless produce
614 correctly formatted output).</p>
616 <div class="note">
617 <p>
618 <em><strong>Note.</strong>
619 Adding declarations to the <span class="css">':left'</span> or
620 <span class="css">':right'</span> pseudo-class
621 does not necessarily influence whether the document
622 comes out of the printer double- or single-sided
623 (which is outside the scope of this specification).</em>
624 </p>
625 </div>
627 <p>
628 The '':first'' pseudo-class only <i title="match">matches</i>
629 the first printed page of a document.
631 <div class="example">
632 <pre>
633 @page { margin: 2cm } /* All margins set to 2cm */
635 @page :first {
636 margin-top: 10cm /* Top margin on first page 10cm */
637 }
638 </pre>
639 </div>
641 <p>
642 The '':blank'' pseudo-class only <i title="match">matches</i>
643 <i title="content-empty page">content-empty pages</i>
644 that appear as a result of
645 <a href="http://www.w3.org/TR/css3-break/#forced-breaks">forced page breaks</a>.
647 <div class="note">
648 <p>Only the ''left'', ''right'', ''recto'' and ''verso'' values
649 of the 'break-before' and 'break-after' properties
650 can generate pages that match '':blank''.
651 </div>
653 <div class="example">
654 <p>In this example, forced page break may occur before <code>h1</code> elements.
655 <pre>
656 h1 { break-before: left }
658 @page :blank {
659 @top-center { content: "This page is intentionally left blank" }
660 }
661 </pre>
662 </div>
664 <p>
665 A page matched by '':blank'' can also be matched
666 by other page pseudo-classes.
668 <div class="example">
670 <p>If headers have been specified on all right pages, a blank right
671 page will be matched by both <code>:blank</code>
672 and <code>:right</code>. Therefore, margin boxes set on right pages
673 will have to be removed unless they are wanted on blank pages. Here is
674 an example where the top center header is removed from blank pages,
675 while the page number remains:
677 <pre>
678 h1 { break-before: left }
680 @page :blank {
681 @top-center { content: none }
682 }
684 @page :right {
685 @top-center { content: "Preliminary edition" }
686 @bottom-center { content: counter(page) }
687 }
688 </pre>
690 <p>Due to the higher <i>specificity</i> of <code>:blank</code>
691 over <code>:right</code>, the top center header is removed even
692 if <code>content: none</code> comes before <code>content: "Preliminary
693 edition"</code>.
695 </div>
697 <div class="note">
698 <p><em><strong>Note.</strong> Future versions of CSS may include other page
699 pseudo-classes.</em></p>
700 </div>
702 <h3 id="syntax-page-selector">@page rule grammar</h3>
704 <p>The syntax for the @page rule is a specialization of the generic at-rule
705 defined by CSS 2.1. This grammar extends the at-rule syntax to allow @page rules
706 nested inside @media rules. User agents <em class="RFC2119">MUST</em> adhere
707 to the following grammar:</p>
709 <p>See [[!CSS21]], Section 4.1.1 and Appendix G for the expansion of missing
710 productions:</p>
711 <p id="specializatons-of-ATKEYWORD">
712 All new lexical tokens are specializations of the ATKEYWORD lexical token:</p>
713 <pre class="lexical">
714 PAGE_SYM ::= "@page"
715 TOPLEFTCORNER_SYM ::= "@top-left-corner"
716 TOPLEFT_SYM ::= "@top-left"
717 TOPCENTER_SYM ::= "@top-center"
718 TOPRIGHT_SYM ::= "@top-right"
719 TOPRIGHTCORNER_SYM ::= "@top-right-corner"
720 BOTTOMLEFTCORNER_SYM ::= "@bottom-left-corner"
721 BOTTOMLEFT_SYM ::= "@bottom-left"
722 BOTTOMCENTER_SYM ::= "@bottom-center"
723 BOTTOMRIGHT_SYM ::= "@bottom-right"
724 BOTTOMRIGHTCORNER_SYM ::= "@bottom-right-corner"
725 LEFTTOP_SYM ::= "@left-top"
726 LEFTMIDDLE_SYM ::= "@left-middle"
727 LEFTBOTTOM_SYM ::= "@left-bottom"
728 RIGHTTOP_SYM ::= "@right-top"
729 RIGHTMIDDLE_SYM ::= "@right-middle"
730 RIGHTBOTTOM_SYM ::= "@right-bottom"
732 <dfn>media</dfn> :
733 MEDIA_SYM S* medium [ COMMA S* medium ]* LBRACE S* [ <i>page_rule</i> | ruleset ]* '}' S*
734 ;
736 <dfn id="syntax-prod-page">page_rule</dfn> :
737 PAGE_SYM S* <i>page_selector_list</i> '{' S* <i>page_body</i> '}' S*
738 ;
740 <dfn>page_selector_list</dfn> :
741 [ <i>page_selector</i> S* [ ',' <i>page_selector</i> S* ]* ]?
742 ;
744 <dfn>page_selector</dfn> :
745 <i>pseudo_page</i>+ | IDENT <i>pseudo_page</i>*
746 ;
748 <dfn id="syntax-prod-pseudo-page">pseudo_page</dfn> :
749 ':' [ "left" | "right" | "first" | "blank" ]
750 ;
752 <dfn>page_body</dfn> : /* Can be empty */
753 declaration? [ ';' S* <i>page_body</i> ]? |
754 <i>page_margin_box</i> <i>page_body</i>
755 ;
757 <dfn id="syntax-prod-margin">page_margin_box</dfn> :
758 <i>margin_sym</i> S* '{' S* declaration? [ ';' S* declaration? ]* '}' S*
759 ;
761 <dfn id="syntax-prod-margin-sym">margin_sym</dfn> :
762 TOPLEFTCORNER_SYM |
763 TOPLEFT_SYM |
764 TOPCENTER_SYM |
765 TOPRIGHT_SYM |
766 TOPRIGHTCORNER_SYM |
767 BOTTOMLEFTCORNER_SYM |
768 BOTTOMLEFT_SYM |
769 BOTTOMCENTER_SYM |
770 BOTTOMRIGHT_SYM |
771 BOTTOMRIGHTCORNER_SYM |
772 LEFTTOP_SYM |
773 LEFTMIDDLE_SYM |
774 LEFTBOTTOM_SYM |
775 RIGHTTOP_SYM |
776 RIGHTMIDDLE_SYM |
777 RIGHTBOTTOM_SYM
778 ;
779 </pre>
781 <div class="example">
782 <p>The following are examples of page selectors (declaration block intentionally
783 left blank)</p>
784 <pre>
785 @page { ... }
786 @page :left { ... }
787 @page :right { ... }
788 @page LandscapeTable { ... }
789 @page CompanyLetterHead:first { ... } /* identifier and pseudo page. */
790 @page:first { ... }
791 @page toc, index { ... }
792 @page :blank:first { ... }
793 </pre>
795 <p>The following are examples of page-margin boxes
796 where the declaration blocks are intentionally left blank.</p>
797 <pre>
798 @page {
799 @top-left { ... /* document name */ }
800 @bottom-center { ... /* page number */}
801 }
802 @page :left { @left-middle { ... /* page number in left margin */ }}
803 @page :right{ @right-middle { ... /* page number in right margins of right pages */}}
805 @page :left { @bottom-left-corner { ... /* left page numbers */ }}
806 @page :right { @bottom-right-corner { ... /* right page numbers */ }}
807 @page :first { @bottom-left-corner { ... /* empty footer on 1st page */ }
808 @bottom-right-corner { ... /* empty footer */ } }
809 </pre>
810 </div>
812 <h3 id="cascading-and-page-context">Cascading in the page context</h3>
814 <p>Declarations in page and margin contexts <a href="http://www.w3.org/TR/CSS21/cascade.html">cascade</a> just like declarations in <a href="http://www.w3.org/TR/CSS21/syndata.html#rule-sets">rule sets</a>.</p>
816 <p>The <dfn>specificity</dfn> of page a selector is computed in a manner
817 analogous to the computations defined in
818 the <a href="http://www.w3.org/TR/CSS21/selector.html">Selectors</a> module:
820 <ul>
821 <li>Count the number of page type names (= <var>f</var>)
822 <p class="note">
823 Given the syntax of page seletors, <var>f</var> can only ever be 0 or 1.
824 <li>Count the number of ':first' or ':blank' pseudo-classes (= <var>g</var>)
825 <li>Count the number of ':left' or ':right' pseudo-classes (= <var>h</var>)
826 </ul>
828 <p>
829 Specificities are compared by comparing the three components in order:
830 the specificity with <var>f</var> larger a value is more specific;
831 if the two <var>f</var> values are tied,
832 then the specificity with a larger <var>g</var> value is more specific;
833 if the two <var>g</var> values are also tied,
834 then the specificity with a larger <var>h</var> value is more specific;
835 if all the values are tied, the two specifities are equal.
837 <p>
838 Due to storage limitations,
839 implementations may have limitations on
840 the size of <var>f</var>, <var>g</var>, or <var>h</var>.
841 If so, values higher than the limit must be clamped to that limit,
842 and not overflow.
844 <p class="note">
845 Note: Each comma-separated selectors in the same ''@page'' rule
846 has its own specificity.
848 <p class="note">
849 Note: Repeated occurrances of the same pseudo-classes are allowed
850 and do increase specificity.
852 <div class="example">
854 <p>Some page specificity calculation examples follow:</p>
855 <pre>
856 @page { } /* specificity = (0,0,0) */
857 @page :left { } /* specificity = (0,0,1) */
858 @page :first { } /* specificity = (0,1,0) */
859 @page artsy { } /* specificity = (1,0,0) */
860 @page artsy:left { } /* specificity = (1,0,1) */
861 @page artsy:first { } /* specificity = (1,1,0) */
862 </pre>
863 </div>
865 <div class="example">
867 <p>Consider the following usage example:</p>
868 <pre>
869 @page {
870 margin-left: 3cm;
871 }
873 @page :left {
874 margin-left: 4cm;
875 }
876 </pre>
878 <p>Due to the higher specificity of the pseudo-class selector,
879 the left margin on left pages will be 4cm and all other pages
880 (the right-facing pages) will have a left margin of 3cm.
881 </div>
883 <div class="example">
884 <p>In this example, the higher specificity of the green rules wins over the red
885 rule.
886 Therefore the first page will have blue text in the top-left page-margin box
887 and green text in the top-right page-margin box,
888 while subsequent pages will have red text in the page-margin boxes.</p>
889 <pre>
890 @page :first {
891 color: green;
893 @top-left {
894 content: "foo";
895 color: blue;
896 }
897 @top-right {
898 content: "bar";
899 }
900 }
902 @page { color: red;
903 @top-center {
904 content: "Page " counter(page);
905 }
906 }
907 </pre>
908 </div>
910 <div class="example">
912 <p>Page contexts cascade, so the following stylesheet would style pages with 25
913 millimeter margins and 14 point type in the page-margin boxes:</p>
914 <pre>
915 @page { margin: 25mm;}
916 @page { font-size: 14pt;}
917 </pre>
918 </div>
920 <h2 id="margin-boxes">Page-Margin Boxes</h2>
922 <p>Page-margin boxes are boxes within the page margin that,
923 like pseudo-elements, can contain generated content.
925 <p>Page-margin boxes can be used to create page headers and footers,
926 which are portions of the page set aside for supplementary information
927 such as the page number or document title.
929 <div class="example">
930 <p>Typically, a <dfn>page header</dfn> is located at the top of the page
931 in documents with a predominately horizontal writing direction
932 and on the side opposite the <a href="#binding-edge">binding edge</a>
933 for documents with a predominately vertical writing direction.
934 One possible design of page headers for horizontally written documents uses the
935 ''@top-left-corner'', ''@top-left'', ''@top-center'', ''@top-right'' and ''@top-right-corner''
936 page-margin boxes.
937 Another design, for vertically written documents, could use the
938 ''@right-top'', ''@right-middle'', and ''@right-bottom'' page-margin boxes
939 for <a href="#right-page">right facing pages</a> and
940 ''@left-top'', ''@left-middle'', and ''@left-bottom''
941 for <a href="#left-page">left facing pages</a>.
943 <p>The <dfn>page footer</dfn> is typically at
944 the opposite end of the page from the page header.
945 For example, the design of a horizontally written document with a page header
946 at the top of the page could use the
947 ''@bottom-left-corner'', ''@bottom-left'', ''@bottom-center'', ''@bottom-right'' and ''@bottom-right-corner''
948 page-margin boxes as the page footer.
949 The design of a vertically written document could use
950 the page-margin boxes of the binding edge of the page for the page footer.
951 </div>
953 <p>Page-margin boxes are positioned with respect to the page area
954 and are independent of page orientation,
955 for example the top page-margin boxes are above the page area
956 in both portrait and landscape orientation.
957 The various page-margin boxes are defined
958 and illustrated in the diagram below:
960 <table id="margin-box-def" class="data" summary="defintion of each of the page-margin boxes">
961 <caption>Table 1 Page-Margin Box Definitions</caption>
962 <thead>
963 <tr>
964 <th>Box</th>
965 <th>Description</th>
966 <th>Placement</th>
967 </tr>
968 </thead>
969 <tbody>
970 <tr id="top-margin-boxes-def">
971 <th id="top-left-corner-box-def">top-left-corner</th>
972 <td>a fixed-size box defined by the intersection of the top and left margins of the
973 page box</td>
974 <td><img src="TopLeftCornerBox.png" alt="the top left corner box with margin, border, and padding, nested within intersection of the page's top and left margins"
975 height="47" width="181"></td>
976 </tr>
977 <tr id="top-left-box-def">
978 <th>top-left</th>
979 <td>a variable-width box filling the top page margin between the top-left-corner
980 and top-center page-margin boxes</td>
981 <td><img src="TopLeftMarginBox.png" alt="the top left box with margin, border, and padding, nested in the page's top margin next to the top left corner box"
982 height="47" width="181"></td>
983 </tr>
984 <tr id="top-center-box-def">
985 <th>top-center</th>
986 <td>a variable-width box centered horizontally between the page's left and right
987 border edges and filling the page top margin between the top-left and top-right
988 page-margin boxes</td>
989 <td><img src="TopCenterMarginBox.png" alt="the top center box with margin, border, and padding, centered within the page's top margin"
990 height="47" width="181"></td>
991 </tr>
992 <tr id="top-right-box-def">
993 <th>top-right</th>
994 <td>a variable-width box filling the top page margin between the top-center and
995 top-right-corner page-margin boxes</td>
996 <td><img src="TopRightMarginBox.png" alt="the top right box with margin, border, and padding, nested within the page's top margin"
997 height="47" width="181"></td>
998 </tr>
999 <tr>
1000 <th id="top-right-corner-box-def">top-right-corner</th>
1001 <td>a fixed-size box defined by the intersection of the top and right margins of
1002 the page box</td>
1003 <td><img src="TopRightCornerMarginBox.png" alt="the top right corner box with margin, border, and padding, nested within the intersection of the page's top and right margin"
1004 height="47" width="181"></td>
1005 </tr>
1006 <tr id="left-margin-boxes-def">
1007 <th id="left-top-box-def">left-top</th>
1008 <td>a variable-height box filling the left page margin between the top-left-corner
1009 and left-middle page-margin boxes</td>
1010 <td rowspan="3"><img src="LeftMarginBoxes.png" alt="left-top, left-middle, and left-bottom page-margin boxes in the page box's left margin"
1011 height="226" width="181"></td>
1012 </tr>
1013 <tr id="left-middle-box-def">
1014 <th>left-middle</th>
1015 <td>a variable-height box centered vertically between the page's top and bottom
1016 border edges and filling the left page margin between the left-top and
1017 left-bottom page-margin boxes</td>
1018 </tr>
1019 <tr id="left-bottom-box-def">
1020 <th>left-bottom</th>
1021 <td>a variable-height box filling the left page margin between the left-middle and
1022 bottom-left-corner page-margin boxes</td>
1023 </tr>
1024 <tr id="right-margin-boxes-def">
1025 <th id="right-top-box-def">right-top</th>
1026 <td>a variable-height box filling the right page margin between the
1027 top-right-corner and right-middle page-margin boxes</td>
1028 <td rowspan="3"><img src="RightMarginBoxes.png" alt="right-top, right-middle, and right-bottom page-margin boxes in the page box's right margin"
1029 height="226" width="181"></td>
1030 </tr>
1031 <tr id="right-middle-box-def">
1032 <th>right-middle</th>
1033 <td>a variable-height box centered vertically between the page's top and bottom
1034 border edges and filling the right page margin between the right-top and
1035 right-bottom page-margin boxes</td>
1036 </tr>
1037 <tr id="right-bottom-box-def">
1038 <th>right-bottom</th>
1039 <td>a variable-height box filling the right page margin between the right-middle
1040 and bottom-right-corner page-margin boxes</td>
1041 </tr>
1042 <tr id="bottom-margin-boxes-def">
1043 <th id="bottom-left-corner-box-def">bottom-left-corner</th>
1044 <td>a fixed-size box defined by the intersection of the bottom and left margins of
1045 the page box</td>
1046 <td><img src="BottomLeftCornerBox.png" alt="bottom left corner box with margin, border, and padding, nested within the page margin at the intersection of the left and bottom page margins"
1047 height="48" width="181"></td>
1048 </tr>
1049 <tr id="bottom-left-box-def">
1050 <th>bottom-left</th>
1051 <td>a variable-width box filling the bottom page margin between the
1052 bottom-left-corner and bottom-center page-margin boxes</td>
1053 <td><img src="BottomLeftMarginBox.png" alt="bottom left page-margin box with margin, border, and padding, nested within the page's bottom margin next to the bottom-left-corner box"
1054 height="48" width="181"></td>
1055 </tr>
1056 <tr id="bottom-center-box-def">
1057 <th>bottom-center</th>
1058 <td>a variable-width box centered horizontally between the page's left and right
1059 border edges and filling the bottom page margin between the bottom-left and
1060 bottom-right page-margin boxes</td>
1061 <td style="vertical-align: middle;"><img src="BottomCenterMarginBox.png" alt="bottom center box with margin, border, and padding, nested within the page's bottom margin and centered on the page"
1062 height="48" width="181"></td>
1063 </tr>
1064 <tr id="bottom-right-box-def">
1065 <th>bottom-right</th>
1066 <td>a variable-width box filling the bottom page margin between the bottom-center
1067 and bottom-right-corner page-margin boxes</td>
1068 <td><img src="BottomRightMarginBox.png" alt="bottom right page-margin box with margin, border, and padding, nested within the page's bottom margin and next to the bottom-right-corner box"
1069 height="48" width="181"></td>
1070 </tr>
1071 <tr id="bottom-right-corner-box-def">
1072 <th>bottom-right-corner</th>
1073 <td>a fixed-size box defined by the intersection of the bottom and right margins of
1074 the page box</td>
1075 <td><img src="BottomRightCornerBox.png" alt="bottom right corner box with margin, border, and padding, nested within the page margin at the intersection of the right and bottom page margins"
1076 height="48" width="181"></td>
1077 </tr>
1078 </tbody>
1079 </table>
1081 <h3 id="margin-at-rules">At-rules for page-margin boxes</h3>
1083 <p>Page-margin boxes are created by
1084 <a href="#margin-at-rules">margin at-rules</a>
1085 inside the <a href="#page-context">page context</a>.
1086 These rules should come after any declarations in the page context as legacy
1087 clients may not handle declarations after margin at-rules correctly.</p>
1089 <p>A <dfn id="margin-at-rule">margin at-rule</dfn> consists of an
1090 <a href="#specializatons-of-ATKEYWORD">ATKEYWORD</a>
1091 that identifies the page-margin box
1092 (e.g. <span class="css">'@top-left'</span>) and a block of declarations (said
1093 to be in the <dfn id="margin-context">margin context</dfn>).</p>
1095 <div class="example">
1097 <p>The following style sheet establishes a page header containing the title
1098 ("Hamlet") on the left side and the page number, preceded by "Page ", on the
1099 right side:</p>
1100 <pre>
1101 @page {
1102 size: 8.5in 11in;
1103 margin: 10%;
1105 @top-left {
1106 content: "Hamlet";
1107 }
1108 @top-right {
1109 content: "Page " counter(page);
1110 }
1111 }
1112 </pre>
1113 </div>
1116 <h3 id="populating-margin-boxes">Populating page-margin boxes</h3>
1118 <p>As with the '':before'' and '':after'' pseudo-elements,
1119 a specified 'content' of ''normal'' on a page-margin box computes to ''none'',
1120 and the page-margin box is <dfn>generated</dfn>
1121 if and only if the computed value
1122 of its 'content' property is not 'none'.
1123 Otherwise it behaves as if it had ''display: none''.
1125 <div class="example">
1126 <p>The following style sheet creates a green box in each corner of the page
1127 except the bottom-left corner.</p>
1128 <pre>
1129 @page {
1130 @top-left-corner { content: " "; border: solid green; }
1131 @top-right-corner { content: url(foo.png); border: solid green; }
1132 @bottom-right-corner { content: counter(page); border: solid green; }
1133 @bottom-left-corner { content: normal; border: solid green; }
1134 }
1135 </pre>
1136 </div>
1138 <h3 id="margin-dimension">Computing Page-margin Box Dimensions</h3>
1140 <p>The width and height of each page-margin box is determined by the rules
1141 below. These rules define the equivalent of CSS2.1 Sections 10.3 and
1142 10.6 for page-margin boxes.</p>
1144 <p>The rules for applying 'min-height', 'max-height', 'min-width', and
1145 'max-width' [[!CSS21]] do apply to page-margin boxes and may imply
1146 a recalculation of the width, height, and/or margins
1147 if the dimensions resulting from the specified 'width' or 'height'
1148 violate their constraints.
1149 If the UA does not support the 'min-height' or 'min-width' properties
1150 then it must behave as if 'min-height' and 'min-width' were always zero.
1152 <h4 id="margin-box-terms"><a id="max-margin-dimension"></a>Page-Margin Box Layout Terminology</h4>
1154 <p>In addition to the box model definitions in CSS2.1 [[!CSS21]],
1155 and the sizing terms in CSS Intrinsic Sizing [[!CSS3-SIZING]],
1156 the following terms are defined for use
1157 in the subsequent page-margin box calculations:
1159 <dl>
1161 <dt><dfn>available width</dfn></dt>
1162 <dd>The sum of the page’s
1163 left border width, left padding, <a href="#page-box">page area</a> width,
1164 right padding, and right border width.
1165 In other words, it is the distance between
1166 the <a href="#page-box">page box</a>’s left right border edges.
1167 This quantity is used when calculating dimensions
1168 of the top and bottom page-margin boxes.
1170 <dt><dfn>available height</dfn></dt>
1171 <dd>The sum of the page’s
1172 top border width, top padding, <a href="#page-box">page area</a> height,
1173 bottom padding, and bottom border width.
1174 In other words, it is the distance between
1175 the <a href="#page-box">page box</a>’s top bottom border edges.
1176 This quantity is used when calculating dimensions
1177 of the left and right page-margin boxes.
1179 <dt><dfn>outer width</dfn></dt>
1180 <dd>The width of the
1181 <a href="http://www.w3.org/TR/CSS21/box.html#outer-edge">outer edge</a>,
1182 as defined in [[!CSS21]].
1184 <dt><dfn>outer min width</dfn></dt>
1185 <dd>Like the <i>outer width</i>, except that
1186 <a href="http://www.w3.org/TR/css3-sizing/#min-content">''min-content''</a>
1187 is used when the width is ''auto''.
1189 <dt><dfn>outer max width</dfn></dt>
1190 <dd>Like the <i>outer width</i>, except that
1191 <a href="http://www.w3.org/TR/css3-sizing/#max-content">''max-content''</a>
1192 is used when 'width' is ''auto''.
1193 </dl>
1195 <p>The <dfn>containing block</dfn> for a corner page-margin box is
1196 the rectangle defined by the intersection of the two page margins meeting at that corner.
1198 <p>For all other page-margin boxes,
1199 the <dfn>containing block</dfn> is the rectangle
1200 formed by the encapsulating page margin minus the containing blocks of the
1201 adjacent corners' page-margin boxes.
1202 This means that the size of this containing block is given
1203 in one dimension by the used page margin and in the other dimension
1204 by the <i>available width</i>
1205 (for top and bottom page-margin boxes) or
1206 <i>available height</i>
1207 (for left and right page-margin boxes).</p>
1209 <h4 id="variable-sizing">
1210 Page-Margin Box Variable Dimension Computation Rules</h4>
1212 <p>The following rules apply to 'top-left', 'top-center' and 'top-right'
1213 page-margin boxes,
1214 which are referred to as A, B, and C, respectively, in this section.</p>
1216 <h5 id="variable-auto-margins">Margins</h5>
1218 <p>If the 'margin-left' or 'margin-right' property of any of the three boxes
1219 computes to ''auto'', the used value is zero.</p>
1221 <h5 id="variable-auto-sizing">Resolving ''auto'' widths</h5>
1223 <p>The following algorithm determines the used width of each box.
1224 For this purpose, boxes that are not <i>generated</i>
1225 are assumed to have a 'width' and an <i>outer width</i> of zero.
1226 </p>
1228 <p class="note">
1229 Note: The high-level goals are (in order of priority) to center the middle
1230 box (B) if it is generated, to minimize overflow and overlap, and to
1231 distribute space proportionally to the amount of content.</p>
1233 <p>If the middle box (B) is not <i>generated</i>,
1234 distribute the <i>available width</i> to A and C as follows:
1236 <ul>
1237 <li>
1238 If only one box has 'width: auto',
1239 its used width is resolved so that
1240 the sum of the <i>outer width</i>s equals <i>available width</i>.
1241 </li>
1243 <li id="flex-fit">
1244 If A and C both have 'width: auto', distribute the space to each box as follows:
1245 <ol>
1246 <li>If the sum of the outer <i>max-content widths</i> is less than the <i>available width</i>,
1247 call that difference the <i>flex space</i>.
1248 Calculate each box's <i>flex factor</i> as proportional to
1249 its outer <i>max-content width</i>,
1250 and set its used outer width to:
1251 <pre><i>max-content width</i> + <i>flex space</i> × <i>flex factor</i> ÷ ∑<i>flex factors</i></pre>
1252 <li>Otherwise if the sum of the outer <i>min-content widths</i> is less than the <i>available width</i>,
1253 call that difference the <i>flex space</i>
1254 calculate each box's <i>flex factor</i> as proportional to
1255 its <i>max-content</i> minus <i>min-content</i>,
1256 and set its used outer width to:
1257 <pre><i>min-content width</i> + <i>flex space</i> × <i>flex factor</i> ÷ ∑<i>flex factors</i></pre>
1258 <li>Otherwise,
1259 calculate its outer size as in the previous case,
1260 but set each box's <i>flex factor</i> as proportional to
1261 its outer <i>min-content width</i>.
1262 </ol>
1263 In each case, both <i>flex factors</i> are assumed to be ''1'' if their sum is equal to zero.
1264 </li>
1265 </ul>
1267 <p>If the middle box (B) is <i>generated</i>,
1268 determine the ''auto'' widths of A, B, and C as follows:
1270 <ol>
1271 <li>
1272 First, resolve any ''auto'' width of the middle box (B):
1273 Assume there are two boxes, B and AC,
1274 where each of AC's dimensions is double the maximum of A and C.
1275 (This preserves B's centering.)
1276 Distribute the space to these two boxes (B and the imaginary AC)
1277 as described for A and C <a href="#fit2">above</a>.
1278 <li>
1279 Then, resolve any ''auto'' widths of the side boxes (A and C)
1280 by setting that box's outer width to
1281 <pre>(<i>available width</i> − <i>used outer size of B</i>) ÷ 2<pre>
1282 </li>
1283 </ol>
1285 <h5 id="variable-minmax">Handling 'min-width' and 'max-width'</h5>
1287 <p>
1288 The 'min-width' and 'max-width' properties [[CSS21]] apply to page-margin
1289 boxes in the variable dimension like on normal elements, except that the
1290 three boxes on the same side are considered together.
1291 </p>
1293 <p>
1294 More precisely:
1295 </p>
1297 <ol>
1298 <li>
1299 The tentative used widths are calculated
1300 (without 'min-width' and 'max-width') following the rules under
1301 <a href="#marginbox-variabledim-with">Resolving ''auto'' widths</a>
1302 above.
1303 </li>
1304 <li>
1305 If the tentative used width of any of the three boxes
1306 is greater than 'max-width', the rules above are applied again,
1307 but this time using the computed value of 'max-width'
1308 as the computed value for 'width'.
1309 </li>
1310 <li>
1311 If the resulting width of any of the three boxes
1312 is smaller than 'min-width', the rules above are applied again,
1313 but this time using the value of 'min-width'
1314 as the computed value for 'width'.
1315 </li>
1316 </ol>
1318 <h5 id="variable-position">Positioning</h5>
1320 <p>
1321 Once the dimensions of the boxes are determined,
1322 they are positioned as follows:
1323 </p>
1325 <ul>
1326 <li>The left outer edge of A is flush with the left edge of the
1327 containing block</li>
1328 <li>The outer area of B is centered in the containing block.</li>
1329 <li>The right outer edge of C is flush with the right edge of the
1330 containing block.</li>
1331 </ul>
1333 <h5 id="variable-mapping">Boxes on other sides</h5>
1335 <p>The used values for 'bottom-left', 'bottom-center' and 'bottom-right'
1336 page-margin boxes are established by the same rules as
1337 for 'top-left', 'top-center', and 'top-right', respectively.</p>
1339 <p>The used values for 'left-top', 'left-middle' and 'left-bottom' boxes are
1340 established by the same rules, with "width" replaced by "height", "left" by
1341 "top", "right" by "bottom" and "center" by "middle".</p>
1343 <p>The used values for 'right-top', 'right-middle' and 'right-bottom'
1344 page-margin boxes
1345 are established by the same rules as for 'left-top', 'left-middle' and
1346 'left-bottom', respectively.</p>
1348 <h4 id="fixed-sizing">Page-Margin Box Fixed Dimension Computation Rules</h4>
1350 <p>The rules below are used to calculate the used values of each
1351 'top-left-corner', 'top-left', 'top-center', 'top-right', and
1352 'top-right-corner' page-margin box's 'height', 'margin-top', and 'margin-bottom'
1353 properties:</p>
1355 <ol>
1356 <li>The following constraint must hold among the used values of the margin
1357 box's properties:
1358 <p>'margin-top' + 'border-top-width' + 'padding-top' + 'height' +
1359 'padding-bottom' + 'border-bottom-width' + 'margin-bottom' = top page margin
1361 <li>If 'border-top-width' + 'padding-top' + 'height' (if it is not ''auto'')
1362 + 'padding-bottom' + 'border-bottom-width', plus 'margin-top' and/or
1363 'margin-bottom' if not ''auto'', is larger than the height of the top page
1364 margin, then any ''auto'' values for 'margin-top' or 'margin-bottom' are, for
1365 the following rules, treated as zero.
1367 <li>If at this point all of 'height', 'margin-top', and 'margin-bottom'
1368 have a computed value other than ''auto'', the values are said to be
1369 "over-constrained". In this case, the specified value of 'margin-top' is
1370 treated as 'auto'.
1372 <li>If there is now exactly one value specified as 'auto', its used value
1373 follows from the equality.
1375 <li>If 'height' is set to 'auto', any other 'auto' values become '0' and
1376 'height' follows from the resulting equality
1378 <li>If both 'margin-top' and 'margin-bottom' are 'auto',
1379 their used values are equal.
1380 This vertically centers the page-margin box content
1381 within the top page margin.
1382 </ol>
1384 <p>The same rules apply to the bottom page-margin boxes (bottom-left-corner,
1385 bottom-left, bottom-center, bottom-right, and bottom-right-corner), except that
1386 in the overconstrained case, the 'margin-bottom' is ignored rather than the
1387 'margin-top'.</p>
1389 <p>Analogous rules govern the properties for the left and right
1390 page-margin boxes with respect to 'width'
1391 (top-left-corner, left-top, left-middle, left-bottom, and
1392 bottom-left-corner; top-right-corner, right-top, right-middle, right-bottom,
1393 bottom-right-corner), with 'top' replaced by 'left', 'bottom' replaced by
1394 'right', and 'height' replaced by 'width'.
1395 In the overconstrained case for left (right) page-margin boxes,
1396 the specified value of 'margin-left' ('margin-right') is ignored.</p>
1398 <h3 id="margin-box-ex">Page-margin box examples</h3>
1400 <p>The following is a collection of examples of page-margin box usage.</p>
1402 <div class="example">
1404 <p>Here is an example of a page with only a top-left header:</p>
1405 <pre>
1406 @page {
1407 @top-left { content: "Header in Left Cell (top-left)" }
1408 }
1409 </pre>
1411 <p>Because there are no contents defined for the top-center or the top-right
1412 page-margin boxes, the extent of the top-left page-margin box
1413 is allowed to cross the center of the page box.</p>
1415 <p><img alt="Header Example 1" src="header-ex-1.png" height="177" width="737"></p>
1416 </div>
1418 <div class="example">
1420 <p>The following is an example of a page with a centered header:</p>
1421 <pre>
1422 @page {
1423 @top-center { content: "Header in Center Cell (top-center)" }
1424 }
1425 </pre>
1427 <p><img alt="Header Example 2" src="header-ex-2.png" height="177" width="737"></p>
1428 </div>
1430 <div class="example">
1432 <p>The following is an example of a page with a single header in the top-right
1433 page-margin box:</p>
1434 <pre>
1435 @page {
1436 @top-right { content: "Header in Right Cell (top-right)" }
1437 }
1438 </pre>
1440 <p>Because the content of the center cell is empty, the extent of the top-right
1441 page-margin box is allowed to cross the center of the page box.</p>
1443 <p><img alt="Header Example 3" src="header-ex-3.png" height="177" width="737"></p>
1444 </div>
1446 <div class="example">
1448 <p>The following is an example of a page with a top-center and a top-left header:</p>
1449 <pre>
1450 @page {
1451 @top-left { content: "Left Cell (top-left)" }
1452 @top-center { content: "Header in Center Cell (top-center)" }
1453 }
1454 </pre>
1456 <p><img alt="Header Example 4" src="header-ex-4.png" height="177" width="737"></p>
1457 </div>
1459 <div class="example">
1461 <p>The following is an example of a page with a top-center and a top-right header:</p>
1462 <pre>
1463 @page {
1464 @top-center { content: "Header in Center Cell (top-center)" }
1465 @top-right { content: "Right Cell (top-right)" }
1466 }
1467 </pre>
1469 <p><img alt="Header Example 5" src="header-ex-5.png" height="177" width="737"></p>
1470 </div>
1472 <div class="example">
1474 <p>The following is an example of a page with top-left and top-right headers:</p>
1475 <pre>
1476 @page {
1477 @top-left { content: "Header in top-left with approx. "
1478 "twice as many words as right cell." }
1479 @top-right { content: "Right cell (top-right)" }
1480 }
1481 </pre>
1483 <p>Because there are no center cell contents, the extent of the top-left is
1484 allowed to cross the center of the page box.</p>
1486 <p><img alt="Header Example 6" src="header-ex-6.png" height="177" width="737"></p>
1487 </div>
1489 <h2 id="page-properties">Page Properties</h2>
1490 <div>
1492 <p>
1493 <a href="#properties-list">Appendix A</a> defines the normative list of
1494 CSS 2.1 [[!CSS21]]
1495 <a href="#page-property-list">properties that apply to page boxes</a>.
1496 If a conforming user agent supports any of these properties on block boxes,
1497 then it <em class="RFC2119">MUST</em> also support that property
1498 in the <i>page context</i>.
1499 This specification additionally defines the 'size' property
1500 that only applies in the page context.
1502 <p>
1503 Properties that apply to the page-margin boxes can also be set
1504 within the page context:
1505 if inheritable or explicitly inherited
1506 (with the ''inherit'' keyword in the margin context),
1507 they will inherit to the page-margin boxes.
1509 <p>
1510 The same appendix defines the normative list of
1511 CSS 2.1 [[!CSS21]]
1512 <a href="#page-property-list">properties that apply to page-margin boxes</a>.
1513 If a conforming user agent supports any of these properties on block boxes,
1514 then it <em class="RFC2119">MUST</em> also support that property
1515 in the <i>margin context</i>
1516 (except for <code>z-index</code>, which is optional for page-margin boxes.)
1518 <p>
1519 Other properties defined by [[!CSS21]] do not apply in these contexts.
1520 Behavior for properties not included in CSS 2.1 is undefined.
1522 <p class="note">
1523 Note: The intent of leaving other properties undefined is to allow the gradual
1524 addition of appropriate CSS3 properties as they emerge, without having to
1525 update this specification with each addition.</p>
1527 <p><a href="http://www.w3.org/TR/CSS21/cascade.html#value-stages">As with
1528 elements in the document</a>, both the page context and the margin context
1529 have a computed value for every property, even if that property does not
1530 apply to the page or page-margin box.</p>
1532 <p>The normal rules for CSS properties apply with the following exceptions:</p>
1534 <ul>
1535 <li>page-margin boxes inherit from the page context.
1536 The page context inherits from the root element.
1537 However, since the previous revision of CSS Paged
1538 Media Level 3 did not specify this point, an implementation that sets
1539 inherited properties in the page context to their initial values (as for the
1540 root element) is also conformant to CSS Paged Media Level 3. Note that this
1541 exception will be removed in Level 4.
1542 <li>Values in units of ''em'' and ''ex'' are interpreted relative to the font
1543 associated with their context. When used on the 'font-size' property in the
1544 margin context, they are relative to the font of the page context. When used
1545 on the 'font-size' property in the page context, they are relative to the
1546 'font-size' of the root element. However, since a previous revision of CSS
1547 Paged Media Level 3 was ambiguous on this point, an implementation that
1548 treats ''em'' and ''ex'' on 'font-size' as relative to the initial value is
1549 also conformant to CSS Paged Media Level 3. Note that this exception will
1550 be removed in Level 4.
1551 <li>Percentage values on the margin and padding properties are relative to the
1552 dimensions of the containing block. For right and left values, percentages are
1553 relative to the width of the containing block; for top and bottom values,
1554 percentages are relative to the height of the containing block.</li>
1555 <li>The used values of 'width' and 'height' have special computation rules
1556 for page boxes and page-margin boxes; see <a href="#page-size">Page Size</a>
1557 and <a href="#margin-box-dimensions">Computing Page-Margin Box Dimensions</a>.
1558 <li>The page background is positioned and painted
1559 <a href="#painting">as described above</a>.
1560 <li>The rules for counter scoping are modified <a href="page-based-counters">as
1561 described below</a>.</li>
1562 <li>
1563 As on the '::before' and '::after' pseudo-elements,
1564 the ''normal'' value of the 'content' property computes to ''none''
1565 on page-margin boxes.
1566 </li>
1567 <li>On page-margin boxes, the 'vertical-align' property behaves
1568 <a href="http://www.w3.org/TR/CSS21/tables.html#height-layout">as specified for table cells</a>.
1569 It <em>always</em> performs alignment in the vertical dimension,
1570 regardless of writing mode.
1571 </ul>
1573 <p>It is <em class="RFC2119">recommended</em> that user agents establish a default
1574 page margin via the user agent stylesheet that includes any non-printable area.
1575 It is further <em class="RFC2119">recommended</em> that authors assume that the
1576 default page area will not include unprintable regions.</p>
1578 <h3 id="page-based-counters">Page-based counters</h3>
1580 <p>Counters can be defined and controlled within an <span class="css">'@page'</span>
1581 rule, and used as content in page-margin boxes.
1582 This is useful for maintaining a page count.</p>
1584 <p>A 'counter-increment' within either a page or margin context causes the counter
1585 to increment with the generation of each page box.</p>
1587 <p>If a counter is reset or incremented within the page context, it is in scope
1588 for all page-margin boxes and obscures all counters of the same name within the
1589 document.</p>
1591 <p>If a counter is reset or incremented within a margin context, it is in scope
1592 for that page-margin box and obscures any counters of the same name
1593 in both the page context and the document.</p>
1595 <p>If a counter that has not been reset or incremented within the margin context
1596 or the page context is used by counter() or counters() in the margin context,
1597 then the resultant value is exactly
1598 as if the page-margin box were an element within
1599 the document at the start of the page, inside the deepest element in the normal
1600 flow that spans the page break. Use of the counter in this way does not affect
1601 the calculation of the counter's value.</p>
1603 <p>
1604 A counter named ''page'' is automatically created
1605 and incremented by 1 on every page of the document,
1606 unless the 'counter-increment' property in the <i>page context</i>
1607 explicitly specifies a different increment for the ''page'' counter.
1608 The implied ''page'' counter is a real counter,
1609 and can be directly affected using the 'counter-increment' and 'counter-reset' properties
1610 when named explicitly in those properties.
1611 It can also be used in the 'counter()' and 'counters()' function forms.
1612 </p>
1614 <div class="example">
1615 <p>The following rules result in the placement of the current page number in the
1616 middle of the outside margin of each page.</p>
1617 <pre>
1618 @page {
1619 margin: 10%;
1621 @top-center {
1622 font-family: sans-serif;
1623 font-weight: bold;
1624 font-size: 2em;
1625 content: counter(page);
1626 }
1627 }
1628 </pre>
1630 <p>Adding the following rule will make all pages even-numbered.</p>
1631 <pre>
1632 @page {
1633 counter-increment: page 2;
1634 }
1635 </pre>
1636 </div>
1638 <p>Additionally, a counter named ''pages'' is automatically created by the UA.
1639 Its value is always the total number of pages in the document. (In continuous
1640 media this is always 1.) The value of ''pages'' cannot be manipulated: while
1641 'counter-reset' and 'counter-increment' statements that set it are valid, they
1642 have no effect.
1644 <p>In all other respects, page-associated counters behave as described in
1645 [[!CSS21]], <a href="TR/CSS21/generate.html#scope">Nested Counters and
1646 Scope</a> and <a href="http://www.w3.org/TR/CSS21/syndata.html#counter">Counters</a>.</p>
1648 <h3 id="margin-text-alignment">Page-margin boxes and default values</h3>
1650 <p>Properties used within page or margin contexts take their initial values from
1651 their respective property definitions; however, user agents must behave as
1652 though the values in the following table were established by rules in the UA
1653 default style sheet.</p>
1654 <table id="margin-values" class="data" summary="definition of page-margin box default properties">
1655 <caption>Table 2. Default values for Page-Margin Boxes</caption>
1656 <thead>
1657 <tr>
1658 <th>Page-margin box</th>
1659 <th><span class="property">'text-align'</span></th>
1660 <th><span class="property">'vertical-align'</span></th>
1661 </tr>
1662 </thead>
1663 <tbody>
1664 <tr>
1665 <td><a href="#top-left-corner-box-def">top-left-corner</a></td>
1666 <td>right</td>
1667 <td>middle</td>
1668 </tr>
1669 <tr>
1670 <td><a href="#top-left-box-def">top-left</a></td>
1671 <td>left</td>
1672 <td>middle</td>
1673 </tr>
1674 <tr>
1675 <td><a href="#top-center-box-def">top-center</a></td>
1676 <td>center</td>
1677 <td>middle</td>
1678 </tr>
1679 <tr>
1680 <td><a href="#top-right-box-def">top-right</a></td>
1681 <td>right</td>
1682 <td>middle</td>
1683 </tr>
1684 <tr>
1685 <td><a href="#top-right-corner-box-def">top-right-corner</a></td>
1686 <td>left</td>
1687 <td>middle</td>
1688 </tr>
1689 <tr>
1690 <td><a href="#left-top-box-def">left-top</a></td>
1691 <td>center</td>
1692 <td>top</td>
1693 </tr>
1694 <tr>
1695 <td><a href="#left-middle-box-def">left-middle</a></td>
1696 <td>center</td>
1697 <td>middle</td>
1698 </tr>
1699 <tr>
1700 <td><a href="#left-bottom-box-def">left-bottom</a></td>
1701 <td>center</td>
1702 <td>bottom</td>
1703 </tr>
1704 <tr>
1705 <td><a href="#right-top-box-def">right-top</a></td>
1706 <td>center</td>
1707 <td>top</td>
1708 </tr>
1709 <tr>
1710 <td><a href="#right-middle-box-def">right-middle</a></td>
1711 <td>center</td>
1712 <td>middle</td>
1713 </tr>
1714 <tr>
1715 <td><a href="#right-bottom-box-def">right-bottom</a></td>
1716 <td>center</td>
1717 <td>bottom</td>
1718 </tr>
1719 <tr>
1720 <td><a href="#bottom-left-corner-box-def">bottom-left-corner</a></td>
1721 <td>right</td>
1722 <td>middle</td>
1723 </tr>
1724 <tr>
1725 <td><a href="#bottom-left-box-def">bottom-left</a></td>
1726 <td>left</td>
1727 <td>middle</td>
1728 </tr>
1729 <tr>
1730 <td><a href="#bottom-center-box-def">bottom-center</a></td>
1731 <td>center</td>
1732 <td>middle</td>
1733 </tr>
1734 <tr>
1735 <td><a href="#bottom-right-box-def">bottom-right</a></td>
1736 <td>right</td>
1737 <td>middle</td>
1738 </tr>
1739 <tr>
1740 <td><a href="#bottom-right-corner-box-def">bottom-right-corner</a></td>
1741 <td>left</td>
1742 <td>middle</td>
1743 </tr>
1744 </tbody>
1745 </table>
1747 <div class="example">
1749 <p>This example style sheet could be used to create a centered header with the
1750 current chapter name:</p>
1751 <pre>body {counter-reset: chapter;}
1752 div.chapter {counter-increment: chapter;}
1753 @page {
1754 margin: 10%;
1755 @top-center { content: "Chapter" counter(chapter) }
1756 }
1757 </pre>
1758 </div>
1760 <h2 id="page-size">Page Size</h2>
1762 <p>People around the world use many different paper sizes. It is a goal of this
1763 specification that web content should be adaptable to a range of different
1764 sizes without having to write a specific style sheet for each paper size.</p>
1766 <p>However, in some situations it is important that a certain page size achieves a
1767 certain style. One way to achieve this goal is to utilize the 'size' property,
1768 which indicates that the document should preferentially be displayed on a
1769 surface of a certain size; another method is to use Media Queries [[MEDIAQ]]
1770 which allow different style sheets to be applied to different page sizes.</p>
1772 <h3 id="page-size-prop">Page size: the 'size' property</h3>
1774 <table class="propdef" summary="definition of the size property">
1775 <tr>
1776 <th>Name:
1777 <td><dfn id="size">size</dfn>
1778 <tr>
1779 <th>Value:
1780 <td><length>{1,2} | auto | [ <page-size> || [ portrait | landscape] ]
1781 <tr>
1782 <th>Initial:
1783 <td>auto
1784 <tr>
1785 <td><em>Applies to:</em>
1786 <td>page context
1787 <tr>
1788 <th>Inherited:
1789 <td>N/A
1790 <tr>
1791 <th>Percentages:
1792 <td>N/A
1793 <tr>
1794 <th>Media:
1795 <td>paged
1796 <tr>
1797 <td><em>Computed value:</em>
1798 <td>specified value
1799 </table>
1801 <p>This property specifies the target size and orientation of the
1802 <a href="#page-box">page box</a>’s containing block.
1803 In the general case, where one page box is rendered onto one <a href="#page-sheet">page sheet</a>,
1804 the 'size' property also indicates the size of the destination page sheet.
1806 <p>The size of a page box can either be "absolute" (fixed size) or "scalable"
1807 (i.e., fitting available sheet sizes).
1808 The first three values in the table below can be used to create scalable page
1809 boxes.
1810 Other values define a fixed-size page box, and thereby indicate the preferred
1811 output media size. When possible, output should be rendered on the media size
1812 indicated.
1813 If the specified size is not available, the rules for
1814 <a href="#renderingpages">transposing a page box to a different size</a>
1815 apply.</p>
1817 <p>If a <code>size</code> property declaration is qualified by a ''width'',
1818 ''height'', ''device-width'', ''device-height'', ''aspect-ratio'',
1819 ''device-aspect-ratio'' or ''orientation''
1820 media query [[!MEDIAQ]] (or other conditional on the size of the paper), then
1821 the declaration must be
1822 <a href="http://www.w3.org/TR/CSS21/conform.html#ignore">ignored</a>. Media
1823 queries do not honor 'size': they assume the paper size that would be chosen
1824 if no @page rules were specified.</p>
1826 <p class=issue>It would be useful if media queries could respond at least
1827 to sizes specified on an unqualified @page.
1829 <div class="example">
1830 <p>In the following example
1831 <pre>
1832 @page {
1833 size: 4in 6in;
1834 }
1836 @media (max-width: 6in) {
1837 @page {
1838 size: letter;
1839 }
1840 }
1841 </pre>
1842 <p>The second <code>size</code> declaration is ignored, i.e. the specified value
1843 of the <code>size</code> property is <code>4in 6in</code>.
1844 </div>
1846 <table class="page-sizes">
1847 <tr>
1848 <th>Value</th>
1849 <th>Description</th>
1850 </tr>
1851 <tr>
1852 <td>auto</td>
1853 <td>The page box will be set to a size and orientation chosen by the UA. In the
1854 usual case, the page box size and orientation is chosen to match the target
1855 media sheet.</td>
1856 </tr>
1857 <tr>
1858 <td>landscape</td>
1859 <td>Specifies that the page's content be printed in landscape orientation. The
1860 longer sides of the page box are horizontal. If a <span class="css">'<page-size>'</span> is not specified, the size of the page sheet
1861 is chosen by the UA.</td>
1862 </tr>
1863 <tr>
1864 <td>portrait</td>
1865 <td>Specifies that the page's content be printed in portrait orientation. The
1866 shorter sides of the page box are horizontal. If a <span class="css">'<page-size>'</span> is not specified, the size of the page sheet
1867 is chosen by the UA.</td>
1868 </tr>
1869 <tr>
1870 <td><length></td>
1871 <td>The page box will be set to the given absolute dimension(s). If only one length
1872 value is specified, it sets both the width and height of the page box (i.e.,
1873 the box is a square). If two length values are specified, the first establishes
1874 the page box width, and the second the page box height. Values in units of
1875 <span class="css">'em'</span> and <span class="css">'ex'</span> refer to the
1876 page context's font. Negative lengths are illegal.</td>
1877 </tr>
1878 <tr>
1879 <td><page-size></td>
1880 <td>A page size can be specified using one of the following media names. This is
1881 the equivalent of specifying the <span class="css">'<page-size>'</span>
1882 using length values. The definition of the the media names comes from
1883 <cite>Media Standardized Names</cite> [[!PWGMSN]].
1885 <dl>
1887 <dt>A5</dt>
1888 <dd>Equivalent to the size of ISO A5 media: 148mm wide and 210 mm high.</dd>
1890 <dt>A4</dt>
1891 <dd>Equivalent to the size of ISO A4 media: 210 mm wide and 297 mm high.</dd>
1893 <dt>A3</dt>
1894 <dd>Equivalent to the size of ISO A3 media: 297mm wide and 420mm high.</dd>
1896 <dt>B5</dt>
1897 <dd>Equivalent to the size of ISO B5 media: 176mm wide by 250mm high.</dd>
1899 <dt>B4</dt>
1900 <dd>Equivalent to the size of ISO B4 media: 250mm wide by 353mm high.</dd>
1902 <dt>letter</dt>
1903 <dd>Equivalent to the size of North American letter media: 8.5 inches wide and 11
1904 inches high</dd>
1906 <dt>legal</dt>
1907 <dd>Equivalent to the size of North American legal: 8.5 inches wide by 14 inches
1908 high.</dd>
1910 <dt>ledger</dt>
1911 <dd>Equivalent to the size of North American ledger: 11 inches wide by 17 inches
1912 high.</dd>
1913 </dl></td>
1914 </tr>
1915 </table>
1917 <p>The '<page-size>' names can be used in conjunction with 'landscape' or
1918 'portrait' to indicate both size and orientation.</p>
1920 <h4>Some examples:</h4>
1922 <div class="example">
1923 <pre>
1924 @page {
1925 size: A4 landscape;
1926 }
1927 </pre>
1929 <p>The above example sets the width of the page box to be 297mm and the height to
1930 be 210mm. The page box in this example should be rendered on a page sheet size
1931 of 210 mm by 297 mm.</p>
1932 </div>
1934 <div class="example">
1936 <p>In the following example, the outer edges of the page box will align with the
1937 page. The percentage value on the <span class="property">'margin'</span>
1938 property is relative to the page size so if the page sheet dimensions are 210mm
1939 x 297mm (i.e., A4), the margins are 21mm and 29.7mm. Assuming there are no page
1940 borders or padding set in the UA default style sheet, the resulting page area
1941 is 189mm by 367.3mm (210mm-21mm by 297mm-29.7mm).</p>
1942 <pre>
1943 @page {
1944 size: auto;/* auto is the initial value */
1945 margin: 10%;
1946 }
1947 </pre>
1948 </div>
1950 <div class="example">
1951 <pre>
1952 @page {
1953 size: 8.5in 11in;/* width height */
1954 }
1955 </pre>
1957 <p>The above example sets the width of the page box to be 8.5 inches and the
1958 height to be 11 inches. This indicates that the page sheet size should be
1959 8.5"x11" and the orientation 'portrait'.</p>
1960 </div>
1962 <h4 id="page-size-media-query">Media Queries</h4>
1964 <p>This section is informative.</p>
1966 <p>By using Media Queries [[MEDIAQ]], one style sheet can express different
1967 stylistic preferences for different page sizes. Consider this example:</p>
1969 <div class="example" style="font-size: 10pt;">
1970 <pre>
1971 /* style sheet for "A4" printing */
1972 @media print and (width: 21cm) and (height: 29.7cm) {
1973 @page {
1974 margin: 3cm;
1975 }
1976 }
1978 /* style sheet for "letter" printing */
1979 @media print and (width: 8.5in) and (height: 11in) {
1980 @page {
1981 margin: 1in;
1982 }
1983 }
1984 </pre>
1985 </div>
1987 <p>In the example above, "A4" sheets are given a "3cm" page margin, and "letter"
1988 sheets are given a "1in" page margin.</p>
1990 <h3 id="renderingpages">Rendering page boxes that do not fit a page sheet</h3>
1992 <p>If a page box does not match the target page sheet dimensions, the user agent
1993 should do one of the following (in order of preference):</p>
1995 <ol>
1996 <li>Render the page box at the indicated size on a larger page sheet.</li>
1997 <li>Rotate the page box 90° if this will make the page box fit the page sheet.</li>
1998 <li>Scale the page box to fit the page sheet. (The aspect ratio of the page box
1999 <em class="RFC2119">should</em> be preserved.)</li>
2000 <li>Graphically "slice" the page box onto multiple page sheets.</li>
2001 <li>Clip overflowed content (least preferred).</li>
2002 </ol>
2004 <p>The user agent <em class="RFC2119">MAY</em> wish to consult the user before
2005 performing these operations.</p>
2007 <h3 id="positioning-page-box">Positioning the page box on the sheet</h3>
2009 <p>When the page box is smaller than the page sheet, the user agent <em class="RFC2119">SHOULD</em> either:</p>
2011 <ul>
2012 <li>center the page box on the sheet since this will align double-sided pages
2013 and avoid accidental loss of information that is printed near the edge of the
2014 sheet; or</li>
2015 <li>position the page box in the upper left corner of the page sheet
2016 (or another corner,
2017 based on the 'direction' and 'writing-mode' properties of the page box)
2018 as this may minimize media consumption.</li>
2019 </ul>
2021 <p>The user agent <em class="RFC2119">MAY</em> wish to consult the user in this
2022 regard.</p><!-- "Page selector and page context" -->
2024 <h2 id="page-breaks">
2025 <a id="pg-br-before-after"></a>
2026 <a id="page-break-before"></a>
2027 <a id="page-break-after"></a>
2028 <a id="page-break-inside"></a>
2029 <a id="breaks-inside"></a>
2030 <a id="orphans"></a>
2031 <a id="widows"></a>
2032 <a id="allowed-pg-brk"></a>
2033 <a id="brk-btw-blocks"></a>
2034 <a id="brk-btw-lines"></a>
2035 <a id="brk-end-block"></a>
2036 <a id="forced-pg-brk"></a>
2037 <a id="best-pg-brk"></a>
2038 Page Breaks
2039 </h2>
2041 <p>
2042 The CSS Fragmentation Module [[!CSS3-BREAK]] module
2043 defines how and where CSS boxes
2044 can be <i>fragmented</i>, including across page breaks.
2045 It defines a few properties that indicate where the user agent
2046 <em class="RFC2119">MAY</em> or <em class="RFC2119">MUST</em> break pages,
2047 and on what page (left or right) the subsequent content resumes.
2048 Each page break ends layout in the current <a href="#page-box">page box</a>
2049 and causes remaining pieces of the document tree to be laid out
2050 in a new page box.
2051 </p>
2053 <h3 id="using-named-pages">Using named pages: 'page'</h3>
2054 <table class="propdef" summary="property definition">
2055 <tr>
2056 <th>Name:
2057 <td><dfn id="page">page</dfn>
2058 <tr>
2059 <th>Value:
2060 <td>auto | <identifier>
2061 <tr>
2062 <th>Initial:
2063 <td>auto
2064 <tr>
2065 <th>Applies to:
2066 <td>boxes that create <a href="http://www.w3.org/TR/css3-break/#btw-blocks">class 1</a> break points
2067 <tr>
2068 <th>Inherited:
2069 <td>no (but see prose)
2070 <tr>
2071 <th>Percentages:
2072 <td>N/A
2073 <tr>
2074 <th>Media:
2075 <td>paged
2076 <tr>
2077 <th>Computed value:
2078 <td>specified value
2079 </table>
2081 <p>
2082 The 'page' property is used to specify a particular type of page (called a <dfn>named page</dfn>)
2083 on which an element <em class="RFC2119">MUST</em> be displayed.
2084 If necessary, a <i>forced page break</i> is introduced
2085 and a new page generated of the specified type.
2087 <p class="note">
2088 This page can be styled by using the same type name
2089 in a <a href="#page-selectors">page selector</a>.
2091 <p>
2092 Page type names are case-sensitive identifiers.
2093 However the ''auto'' value, being a CSS keyword, is
2094 <a href="http://www.w3.org/TR/CSS21/syndata.html#characters">ASCII case-insensitive</a>.
2096 <p>
2097 The 'page' property does not inherit.
2098 However, if the 'page' value on an element is ''auto'',
2099 then its used value is the value specified
2100 on its nearest ancestor with a non-auto value.
2101 When specified on the root element,
2102 the used value for ''auto'' is the empty string.
2104 <!-- See http://www.w3.org/TR/2007/WD-css3-gcpm-20070504/#named3 -->
2106 <p>
2107 Because a previous version of this specification
2108 indicated that the 'page' property is inherited,
2109 an implementation that inherits the 'page' property
2110 and treats ''auto'' as always naming the empty string
2111 remains conformant to CSS Paged Media Level 3.
2112 Note that this exception will be removed in Level 4.
2113 Therefore authors should not explicitly specify the ''auto'' value
2114 on a descendant of an element with a non-''auto'' value,
2115 as the resulting behavior will be unpredictable.
2117 <p>
2118 The 'page' property works as follows:
2120 <ol>
2122 <li>
2123 First, any ''auto'' values are resolved against non-''auto'' ancestors
2124 (as specified above).
2126 <li>
2127 Next,
2128 a <dfn>start 'page' value</dfn> and <dfn>end 'page' value</dfn>
2129 is determined for each box
2130 as the value (if any) propagated from its first or last child (respectively),
2131 else the used value on the box itself.
2132 A child propagates its own <i title="start page value">start</i> or <i>end 'page' value</i>
2133 if and only if the 'page' property applies to it.
2135 <li>
2136 The first printed page’s type is the <i>start 'page' value</i> of the root.
2138 <li>
2139 If for any two boxes meeting at a <a href="http://www.w3.org/TR/css3-break/#btw-blocks">Class 1</a> break point,
2140 the <i>end 'page' value</i> of the box preceding the break
2141 and <i>start 'page' value</i> of the box succeeding the break
2142 do not match,
2143 then a page break is forced between the two boxes,
2144 and content after the break resumes on a page box of the named type.
2145 </ol>
2147 <p class="note">
2148 Essentially, the two 'page' values compared are those from the deepest boxes
2149 meeting at the class 1 break point,
2150 ignoring any subtrees rooted by boxes to which the 'page' property does not apply.
2152 <p>See [[!CSS3-BREAK]] for additional details on page breaks.
2154 <div class="example">
2156 <p>In this example, the two tables are rendered on landscape pages (indeed, on the
2157 same page, if they fit). The page type "narrow" is used for the <p> after
2158 the second table, as the page properties for the table element are no longer in
2159 effect:</p>
2160 <pre>
2161 @page narrow { size: 9cm 18cm }
2162 @page rotated { size: landscape }
2163 div { page: narrow }
2164 table { page: rotated }
2165 </pre>with this document:
2166 <pre>
2167 <div>
2168 <table>...</table>
2169 <table>...</table>
2170 <p>This text is rendered on a 'narrow' page</p>
2171 </div>
2172 </pre>
2173 </div>
2175 <div class="example">
2176 <p>In Japanese documents, sometimes different parts of a single document
2177 will have different <i lang="ja-Latn">kihon hanmen</i>. [[JLREQ]]
2178 The 'page' property, together with ''@page'' rules specifying different page widths,
2179 can accomodate this type of layout:
2180 <pre>
2181 <!DOCTYPE html>
2182 <html lang="ja">
2183 <style>
2184 html { writing-mode: vertical-rl;
2185 line-height: 1.6; }
2186 .main { page: main;
2187 columns: 2; column-gap: 1rem; }
2188 .index { page: index;
2189 columns: 3; column-gap: 1rem; }
2190 @page { margin: auto; /* center kihon hanmen on page */
2191 width: 40rem; } /* 1.6 × 25 lines */
2192 @page main { height: 61rem; } /* 2 × 30 chars + 1 × gap */
2193 @page index { height: 62rem; } /* 3 × 20 chars + 2 × gap */
2194 </style>
2195 <section class="main"> ... </section>
2196 <section class="index"> ... </section>
2197 </html>
2198 </pre>
2199 </div>
2202 <h2 id="image-properties">Image Properties</h2>
2204 <p class="note">This section has been moved to [[CSS3-IMAGES]].</p>
2206 <h2 class="no-num" id="properties-list">Appendix A: Applicable CSS2.1 Properties</h2>
2208 <h3 class="no-num" id="page-property-list">
2209 CSS 2.1 Properties that apply within the page context</h3>
2211 <p>
2212 This list is described in the
2213 <a href="#page-properties">Page Properties</a> section.
2215 <table class="property-list">
2216 <tbody>
2217 <tr><td rowspan="2"><a href="http://www.w3.org/TR/CSS21/visuren.html#direction">bidi properties</a>
2218 <td>direction
2219 <tbody>
2220 <tr><td rowspan="6"><a href="http://www.w3.org/TR/CSS21/colors.html#background-properties">background properties</a>
2221 <td>background-color
2222 <tr><td>background-image
2223 <tr><td>background-repeat
2224 <tr><td>background-attachment
2225 <tr><td>background-position
2226 <tr><td>background
2227 <tbody>
2228 <tr><td rowspan="20"><a href="http://www.w3.org/TR/CSS21/box.html#border-properties">border properties</a>
2229 <td>border-top-width
2230 <tr><td>border-right-width
2231 <tr><td>border-bottom-width
2232 <tr><td>border-left-width
2233 <tr><td>border-width
2234 <tr><td>border-top-color
2235 <tr><td>border-right-color
2236 <tr><td>border-bottom-color
2237 <tr><td>border-left-color
2238 <tr><td>border-color
2239 <tr><td>border-top-style
2240 <tr><td>border-right-style
2241 <tr><td>border-bottom-style
2242 <tr><td>border-left-style
2243 <tr><td>border-short-style
2244 <tr><td>border-top
2245 <tr><td>border-right
2246 <tr><td>border-bottom
2247 <tr><td>border-left
2248 <tr><td>border
2249 <tbody>
2250 <tr><td rowspan="2"><a href="http://www.w3.org/TR/CSS21/generate.html#counters">counter properties</a>
2251 <td>counter-reset
2252 <tr><td>counter-increment
2253 <tbody>
2254 <tr><td colspan="2"><a href="http://www.w3.org/TR/CSS21/colors.html#propdef-color">color</a>
2255 <tbody>
2256 <tr><td rowspan="6"><a href="http://www.w3.org/TR/CSS21/fonts.html">font properties</a>
2257 <td>font-family
2258 <tr><td>font-size
2259 <tr><td>font-style
2260 <tr><td>font-variant
2261 <tr><td>font-weight
2262 <tr><td>font
2263 <tbody>
2264 <tr><td rowspan="3"><a href="http://www.w3.org/TR/CSS21/visudet.html#the-height-property">height</a> <a href="http://www.w3.org/TR/CSS21/visudet.html#min-max-heights">properties</a>
2265 <td>height
2266 <tr><td>min-height
2267 <tr><td>max-height
2268 <tbody>
2269 <tr><td colspan="2"><a href="http://www.w3.org/TR/CSS21/visudet.html#line-height">line-height</a>
2270 <tbody>
2271 <tr><td rowspan="5"><a href="http://www.w3.org/TR/CSS21/box.html#margin-properties">margin properties</a>
2272 <td>margin-top
2273 <tr><td>margin-right
2274 <tr><td>margin-bottom
2275 <tr><td>margin-left
2276 <tr><td>margin
2277 <tbody>
2278 <tr><td rowspan="5"><a href="http://www.w3.org/TR/CSS21/ui.html#dynamic-outlines">outline properties</a>
2279 <td>outline-width
2280 <tr><td>outline-style
2281 <tr><td>outline-color
2282 <tr><td>outline
2283 <tbody>
2284 <tr><td rowspan="5"><a href="http://www.w3.org/TR/CSS21/box.html#padding-properties">padding properties</a>
2285 <td>padding-top
2286 <tr><td>padding-right
2287 <tr><td>padding-bottom
2288 <tr><td>padding-left
2289 <tr><td>padding
2290 <tbody>
2291 <tr><td colspan="2"><a href="http://www.w3.org/TR/CSS21/generate.html#quotes-specify">quotes</a>
2292 <tbody>
2293 <tr><td rowspan="7"><a href="http://www.w3.org/TR/CSS21/text.html">text properties</a>
2294 <td>letter-spacing
2295 <tr><td>text-align
2296 <tr><td>text-decoration
2297 <tr><td>text-indent
2298 <tr><td>text-transform
2299 <tr><td>white-space
2300 <tr><td>word-spacing
2301 <tbody>
2302 <tr><td colspan="2"><a href="http://www.w3.org/TR/CSS21/visufx.html#visibility">visibility</a>
2303 <tbody>
2304 <tr><td rowspan="3"><a href="http://www.w3.org/TR/CSS21/visudet.html#the-width-property">width</a> <a href="http://www.w3.org/TR/CSS21/visudet.html#min-max-widths">properties</a>
2305 <td>width
2306 <tr><td>min-width
2307 <tr><td>max-width
2308 </table>
2311 <h3 class="no-num" id="margin-property-list">
2312 CSS 2.1 properties that apply within the margin contexts</h3>
2314 <p>
2315 This list is described in the
2316 <a href="#page-properties">Page Properties</a> section.
2318 <table class="property-list">
2319 <tbody>
2320 <tr><td rowspan="2"><a href="http://www.w3.org/TR/CSS21/visuren.html#direction">bidi properties</a>
2321 <td>direction
2322 <tr><td>unicode-bidi
2323 <tbody>
2324 <tr><td rowspan="6"><a href="http://www.w3.org/TR/CSS21/colors.html#background-properties">background properties</a>
2325 <td>background-color
2326 <tr><td>background-image
2327 <tr><td>background-repeat
2328 <tr><td>background-attachment
2329 <tr><td>background-position
2330 <tr><td>background
2331 <tbody>
2332 <tr><td rowspan="20"><a href="http://www.w3.org/TR/CSS21/box.html#border-properties">border properties</a>
2333 <td>border-top-width
2334 <tr><td>border-right-width
2335 <tr><td>border-bottom-width
2336 <tr><td>border-left-width
2337 <tr><td>border-width
2338 <tr><td>border-top-color
2339 <tr><td>border-right-color
2340 <tr><td>border-bottom-color
2341 <tr><td>border-left-color
2342 <tr><td>border-color
2343 <tr><td>border-top-style
2344 <tr><td>border-right-style
2345 <tr><td>border-bottom-style
2346 <tr><td>border-left-style
2347 <tr><td>border-short-style
2348 <tr><td>border-top
2349 <tr><td>border-right
2350 <tr><td>border-bottom
2351 <tr><td>border-left
2352 <tr><td>border
2353 <tbody>
2354 <tr><td rowspan="2"><a href="http://www.w3.org/TR/CSS21/generate.html#counters">counter properties</a>
2355 <td>counter-reset
2356 <tr><td>counter-increment
2357 <tbody>
2358 <tr><td colspan="2"><a href="">content</a>
2359 <tbody>
2360 <tr><td colspan="2"><a href="http://www.w3.org/TR/CSS21/colors.html#propdef-color">color</a>
2361 <tbody>
2362 <tr><td rowspan="6"><a href="http://www.w3.org/TR/CSS21/fonts.html">font properties</a>
2363 <td>font-family
2364 <tr><td>font-size
2365 <tr><td>font-style
2366 <tr><td>font-variant
2367 <tr><td>font-weight
2368 <tr><td>font
2369 <tbody>
2370 <tr><td rowspan="3"><a href="http://www.w3.org/TR/CSS21/visudet.html#the-height-property">height</a> <a href="http://www.w3.org/TR/CSS21/visudet.html#min-max-heights">properties</a>
2371 <td>height
2372 <tr><td>min-height
2373 <tr><td>max-height
2374 <tbody>
2375 <tr><td colspan="2"><a href="http://www.w3.org/TR/CSS21/visudet.html#line-height">line-height</a>
2376 <tbody>
2377 <tr><td rowspan="5"><a href="http://www.w3.org/TR/CSS21/box.html#margin-properties">margin properties</a>
2378 <td>margin-top
2379 <tr><td>margin-right
2380 <tr><td>margin-bottom
2381 <tr><td>margin-left
2382 <tr><td>margin
2383 <tbody>
2384 <tr><td rowspan="5"><a href="http://www.w3.org/TR/CSS21/ui.html#dynamic-outlines">outline properties</a>
2385 <td>outline-width
2386 <tr><td>outline-style
2387 <tr><td>outline-color
2388 <tr><td>outline
2389 <tbody>
2390 <tr><td colspan="2"><a href="http://www.w3.org/TR/CSS21/visufx.html#overflow">overflow</a>
2391 <tbody>
2392 <tr><td rowspan="5"><a href="http://www.w3.org/TR/CSS21/box.html#padding-properties">padding properties</a>
2393 <td>padding-top
2394 <tr><td>padding-right
2395 <tr><td>padding-bottom
2396 <tr><td>padding-left
2397 <tr><td>padding
2398 <tbody>
2399 <tr><td colspan="2"><a href="http://www.w3.org/TR/CSS21/generate.html#quotes-specify">quotes</a>
2400 <tbody>
2401 <tr><td rowspan="7"><a href="http://www.w3.org/TR/CSS21/text.html">text properties</a>
2402 <td>letter-spacing
2403 <tr><td>text-align
2404 <tr><td>text-decoration
2405 <tr><td>text-indent
2406 <tr><td>text-transform
2407 <tr><td>white-space
2408 <tr><td>word-spacing
2409 <tbody>
2410 <tr><td colspan="2"><a href="http://www.w3.org/TR/CSS21/visudet.html#line-height">vertical-align</a>
2411 <tbody>
2412 <tr><td colspan="2"><a href="http://www.w3.org/TR/CSS21/visufx.html#visibility">visibility</a>
2413 <tbody>
2414 <tr><td rowspan="3"><a href="http://www.w3.org/TR/CSS21/visudet.html#the-width-property">width</a> <a href="http://www.w3.org/TR/CSS21/visudet.html#min-max-widths">properties</a>
2415 <td>width
2416 <tr><td>min-width
2417 <tr><td>max-width
2418 <tbody>
2419 <tr><td colspan="2"><a href="http://www.w3.org/TR/CSS21/visuren.html#z-index">z-index</a>
2420 </table>
2422 <h2 class="no-num" id="transfer-possibilities">Appendix B: Transfer Possibilities</h2>
2424 <p>Often, but not always, the page box has a one-to-one correspondence to the
2425 physical surface onto which the document is ultimately rendered. The CSS3 page
2426 model specifies formatting within the page box, but it is the user agent's
2427 responsibility to transfer the page box to the sheet. Some user agent transfer
2428 possibilities that are not addressed by CSS3 include:</p>
2430 <ul id="complex-usecases">
2431 <li>Transferring one page box to one sheet (e.g. single-sided printing);</li>
2432 <li>Transferring two page boxes to the front and back surfaces of the same
2433 sheet (e.g. double-sided printing);</li>
2434 <li>Transferring N (small) page boxes to one sheet (called "N-up");</li>
2435 <li>Transferring one (large) page box to N x M sheets (called "tiling");</li>
2436 <li>Creating signatures. A <dfn>signature</dfn> is a group of pages printed on
2437 a sheet, which, when folded and trimmed like a book, appear in their proper
2438 sequence;</li>
2439 <li>Printing one document to multiple output trays;</li>
2440 <li>Generating files containing print instructions.</li>
2441 </ul>
2443 <h2 class="no-num" id="changes">Changes</h2>
2445 <p>
2446 Changes since the <a href="http://www.w3.org/TR/2006/WD-css3-page-20061010/">10 October 2006 Working Draft</a> are:
2447 </p>
2449 <ul>
2450 <li>The first printed page can be <a href="#using-named-pages">named</a>.
2452 <li>The '':blank'' <a href="#pseudo-classes">pseudo-class</a> was imported
2453 from the <a href="http://dev.w3.org/csswg/css3-gcpm/">Generated Content for Paged Media</a> module.
2455 <li>''@page'' rules can now take multiple comma separated selectors,
2456 each selector can have multiple pseudo-classes.
2458 <div class="example">
2459 <pre>@page :first, :blank { @bottom-center { content: none } }</pre>
2460 <pre>@page :first:left { @bottom-left { content: none } }</pre>
2461 </div>
2463 <li>Margin boxes are renamed <a href="#margin-boxes">page-margin boxes</a>,
2464 to avoid confusion with the margin area of each box.
2466 <li>The <a href="#variable-sizing">Variable Dimension</a>
2467 layout rules for page-margin boxes have been much simplified
2468 to not require quadratic optimization.
2470 <li>The relative <a href="#painting">painting order</a>
2471 of page-margin boxes and page content has changed.
2473 <li>The description of page breaks and definition of related properties
2474 (except for the 'page' property)
2475 have been moved to the CSS Fragmentation Module. [[!CSS3-BREAK]]
2477 <li>The 'fit' and 'fit-position' properties
2478 are renamed to 'object-fit' and 'object-position',
2479 redefined to enable additional use cases,
2480 and moved to the CSS3 Image Values and Replaced Content module.
2481 [[CSS3-IMAGES]]
2483 <li>Many miscellaneous clarifications
2484 and editorial improvements have been incorporated.
2486 </ul>
2489 <h2 class="no-num" id="references">References</h2>
2491 <h3 class="no-num" id="normative-references">Normative References</h3><!--normative-->
2493 <h3 class="no-num" id="informative-references">Informative References</h3><!--informative-->
2494 </div>
2495 </div>
2496 </body>
2497 </html>