css3-page/Overview.src.html

Sun, 24 Feb 2013 01:31:32 +0100

author
Simon Sapin <simon.sapin@exyr.org>
date
Sun, 24 Feb 2013 01:31:32 +0100
changeset 7558
33f961bea4f4
parent 7557
6eb9a1b0e447
child 7560
ee2ff2976a1a
permissions
-rwxr-xr-x

[css3-page] Allow the first printed page to be "named".

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

mercurial