css3-page/Overview.html

Mon, 11 Feb 2013 14:15:36 -0800

author
Simon Sapin <simon.sapin@exyr.org>
date
Mon, 11 Feb 2013 14:15:36 -0800
changeset 7435
2fa0f76c392e
parent 7430
066f84678109
child 7436
6ded58aacc4c
permissions
-rwxr-xr-x

[css3-page][css3-gcpm] Move :blank to css3-page, per WG resolution

CSSWG resolution:
http://lists.w3.org/Archives/Public/www-style/2012Nov/0250.html

fantasai@213 1 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
fantasai@213 2
fantasai@213 3 <html lang=en>
simon@6795 4 <head profile="http://dublincore.org/documents/2008/08/04/dc-html/ ">
fantasai@215 5 <title> CSS Paged Media Module Level 3</title>
simon@6795 6
simon@6957 7 <link href="http://purl.org/dc/terms/" rel=schema.dcterms>
simon@6795 8 <link href="http://www.w3.org/Consortium/Legal/ipr-notice#Copyright"
simon@6957 9 rel=dcterms.rights>
simon@6957 10 <meta content=" CSS Paged Media Module Level 3" name=dcterms.title>
simon@6957 11 <meta content=text name=dcterms.type>
simon@7428 12 <meta content=2013-02-11 name=dcterms.issued>
simon@6957 13 <meta content="Melinda Grant" name=dcterms.creator>
simon@6957 14 <meta content="Håkon Wium Lie" name=dcterms.creator>
simon@6957 15 <meta content="Elika J. Etemad" name=dcterms.creator>
simon@7067 16 <meta content="Simon Sapin" name=dcterms.creator>
simon@6957 17 <meta content=W3C name=dcterms.publisher>
simon@7428 18 <meta content="http://www.w3.org/TR/2013/ED-css3-page-20130211/"
simon@6957 19 name=dcterms.identifier>
fantasai@213 20 <meta content="text/html; charset=utf-8" http-equiv=Content-Type>
fantasai@213 21 <link href="../default.css" rel=stylesheet type="text/css">
fantasai@213 22 <link href="http://www.w3.org/StyleSheets/TR/W3C-ED.css" rel=stylesheet
simon@6795 23 type="text/css">
fantasai@215 24 <style type="text/css">
fantasai@215 25 .keyword { font-weight:bold }
fantasai@213 26 .equation { padding: 2% }
fantasai@213 27 table.equation {text-align:center}
fantasai@213 28 td, th { vertical-align: top }
fantasai@213 29 pre { font-size: 1em; }
simon@6957 30
simon@6957 31 #margin-values { border-collapse: collapse; }
simon@6957 32 #margin-values td,
simon@6957 33 #margin-values th
simon@6957 34 {
simon@6957 35 padding: 0.2em;
fantasai@213 36 border: thin solid black;
fantasai@213 37 }
fantasai@213 38
fantasai@213 39 .property-list
fantasai@213 40 {
fantasai@213 41 border: 1px solid black;
fantasai@213 42 padding: .2em;
fantasai@213 43 margin-top: 2em;
fantasai@213 44 }
simon@6957 45
fantasai@213 46 .property-list td
fantasai@213 47 {
fantasai@213 48 border: 1px solid black;
fantasai@213 49 padding: .1em;
fantasai@213 50 }
fantasai@213 51
simon@6957 52 .editorial
simon@6957 53 {
simon@6957 54 display: block;
fantasai@213 55 font-family: arial, helvetica, sans-serif;
fantasai@213 56 font-size: 80%;
simon@6957 57 margin-left: .5in;
simon@6957 58 margin-right: 1in ;
fantasai@213 59 padding: 0.125in;
fantasai@213 60 background: #FFFFDD ;
fantasai@213 61 }
simon@6957 62
fantasai@213 63 .editorial:after { content: "Ed."}
simon@6957 64 .RFC2119
simon@6957 65 {
simon@6957 66 text-transform: lowercase;
simon@6957 67 font-style: italic
fantasai@213 68 }
simon@6957 69
simon@6957 70 em em.RFC2119
fantasai@213 71 {
simon@6957 72 text-transform: lowercase;
simon@6957 73 font-style: normal
simon@6957 74 }
simon@6957 75
simon@6957 76 table.page-sizes
simon@6957 77 {
simon@6957 78 border: thin solid;
fantasai@213 79 margin-top: 1.5em;
fantasai@213 80 }
simon@6957 81 table.page-sizes td
simon@6957 82 {
simon@6957 83 border: thin solid;
fantasai@213 84 padding: .5em;
fantasai@213 85 }
simon@6957 86 table.page-sizes th
simon@6957 87 {
simon@6957 88 border: thin solid;
simon@6957 89 padding: .5em;
fantasai@213 90 background: #ffffaa;
fantasai@213 91 }
fantasai@213 92
fantasai@211 93 </style>
fantasai@114 94
fantasai@114 95 <body>
fantasai@114 96 <div>
fantasai@213 97 <div class=head> <!--begin-logo-->
fantasai@213 98 <p><a href="http://www.w3.org/"><img alt=W3C height=48
fantasai@657 99 src="http://www.w3.org/Icons/w3c_home" width=72></a> <!--end-logo-->
fantasai@213 100
fantasai@1052 101 <h1>CSS Paged Media Module Level 3</h1>
fantasai@1052 102
simon@7428 103 <h2 class="no-num no-toc" id=w3c-working>Editor's Draft 11 February 2013</h2>
fantasai@114 104
fantasai@114 105 <dl>
fantasai@213 106 <dt>This version:
fantasai@213 107
fantasai@213 108 <dd><a
fantasai@213 109 href="http://dev.w3.org/csswg/css3-page/">http://dev.w3.org/csswg/css3-page/</a></dd>
simon@7428 110 <!-- <dd><a href="http://www.w3.org/TR/2013/ED-css3-page-20130211/">http://www.w3.org/TR/2013/WD-css3-page-20130211</a></dd> -->
fantasai@213 111
fantasai@213 112 <dt>Latest version:
fantasai@213 113
fantasai@213 114 <dd><a
fantasai@211 115 href="http://www.w3.org/TR/css3-page">http://www.w3.org/TR/css3-page</a>
fantasai@213 116
fantasai@213 117 <dt>Previous version:
fantasai@213 118
fantasai@213 119 <dd><a
fantasai@211 120 href="http://www.w3.org/TR/2004/CR-css3-page-20040225/">http://www.w3.org/TR/2004/CR-css3-page-20040225/</a>
fantasai@213 121
fantasai@213 122 <dt>Editors:
fantasai@213 123
fantasai@213 124 <dd>Melinda Grant, Hewlett-Packard
fantasai@213 125
fantasai@5967 126 <dd>Håkon Wium Lie, Opera Software
fantasai@213 127
fantasai@213 128 <dd>Elika J. Etemad, Hewlett-Packard
simon@7067 129
simon@7067 130 <dd>Simon Sapin, Kozea
fantasai@114 131 </dl>
fantasai@114 132 <!--begin-copyright-->
fantasai@213 133 <p class=copyright><a
fantasai@114 134 href="http://www.w3.org/Consortium/Legal/ipr-notice#Copyright"
simon@7289 135 rel=license>Copyright</a> © 2013 <a href="http://www.w3.org/"><abbr
fantasai@5967 136 title="World Wide Web Consortium">W3C</abbr></a><sup>®</sup> (<a
fantasai@5967 137 href="http://www.csail.mit.edu/"><abbr
fantasai@5967 138 title="Massachusetts Institute of Technology">MIT</abbr></a>, <a
fantasai@5967 139 href="http://www.ercim.eu/"><abbr
fantasai@5967 140 title="European Research Consortium for Informatics and Mathematics">ERCIM</abbr></a>,
simon@7289 141 <a href="http://www.keio.ac.jp/">Keio</a>, <a
simon@7289 142 href="http://ev.buaa.edu.cn/">Beihang</a>), All Rights Reserved. W3C <a
fantasai@114 143 href="http://www.w3.org/Consortium/Legal/ipr-notice#Legal_Disclaimer">liability</a>,
fantasai@114 144 <a
fantasai@114 145 href="http://www.w3.org/Consortium/Legal/ipr-notice#W3C_Trademarks">trademark</a>
fantasai@114 146 and <a
fantasai@114 147 href="http://www.w3.org/Consortium/Legal/copyright-documents">document
fantasai@114 148 use</a> rules apply.</p>
fantasai@114 149 <!--end-copyright--></div>
fantasai@114 150
fantasai@213 151 <hr title="Separator for header">
fantasai@213 152
fantasai@213 153 <h2 class="no-num no-toc" id=abstract>Abstract</h2>
fantasai@213 154
fantasai@213 155 <p>This module describes the page model that partitions a flow into pages.
fantasai@5976 156 It builds on the <a href="http://www.w3.org/TR/CSS21/box.html">Box model
fantasai@5976 157 module</a> and introduces and defines the page model and paged media. It
fantasai@5976 158 adds functionality for pagination, page margins, page size and
fantasai@5976 159 orientation, headers and footers, widows and orphans, and image
fantasai@5976 160 orientation. Finally it extends generated content to enable page
fantasai@5976 161 numbering and running headers / footers.</p>
fantasai@114 162 <!-- "Status of this document" -->
fantasai@213 163 <h2 class="no-num no-toc" id=status>Status of this Document</h2>
fantasai@114 164 <!--begin-status-->
fantasai@213 165 <p>This is a public copy of the editors' draft. It is provided for
fantasai@517 166 discussion only and may change at any moment. Its publication here does
fantasai@517 167 not imply endorsement of its contents by W3C. Don't cite this document
simon@6795 168 other than as work in progress.
fantasai@517 169
fantasai@517 170 <p>The (<a
fantasai@517 171 href="http://lists.w3.org/Archives/Public/www-style/">archived</a>)
fantasai@517 172 public mailing list <a
fantasai@1626 173 href="mailto:www-style@w3.org?Subject=%5Bcss3-page%5D%20PUT%20SUBJECT%20HERE">
fantasai@1626 174 www-style@w3.org</a> (see <a
fantasai@517 175 href="http://www.w3.org/Mail/Request">instructions</a>) is preferred for
fantasai@517 176 discussion of this specification. When sending e-mail, please put the
fantasai@5967 177 text “css3-page” in the subject, preferably like this:
simon@6795 178 “[<!---->css3-page<!---->] <em>…summary of comment…</em>”
fantasai@517 179
fantasai@517 180 <p>This document was produced by the <a href="/Style/CSS/members">CSS
fantasai@657 181 Working Group</a> (part of the <a href="/Style/">Style Activity</a>).
fantasai@517 182
fantasai@517 183 <p>This document was produced by a group operating under the <a
fantasai@517 184 href="/Consortium/Patent-Policy-20040205/">5 February 2004 W3C Patent
fantasai@517 185 Policy</a>. W3C maintains a <a href="/2004/01/pp-impl/32061/status"
fantasai@517 186 rel=disclosure>public list of any patent disclosures</a> made in
fantasai@517 187 connection with the deliverables of the group; that page also includes
fantasai@517 188 instructions for disclosing a patent. An individual who has actual
fantasai@517 189 knowledge of a patent which the individual believes contains <a
fantasai@517 190 href="/Consortium/Patent-Policy-20040205/#def-essential">Essential
fantasai@517 191 Claim(s)</a> must disclose the information in accordance with <a
fantasai@517 192 href="/Consortium/Patent-Policy-20040205/#sec-Disclosure">section 6 of
fantasai@517 193 the W3C Patent Policy</a>.</p>
fantasai@517 194 <!--end-status-->
fantasai@3574 195 <p>This document contains the <abbr
fantasai@3574 196 title="Cascading Style Sheets">CSS3</abbr> Paged Media Module W3C Last
fantasai@3574 197 Call <a href="/2005/10/Process-20051014/tr.html#RecsWD">Working Draft</a>
simon@7428 198 of 11 February 2013. The Last Call period ends on <span
simon@6795 199 class=fudge>TBD</span>.
fantasai@2094 200
fantasai@2094 201 <p>Relative to the previous Last Call Working Draft, this version has
fantasai@5967 202 dropped the formerly named ‘<code class=property>fit</code>’ and
fantasai@5967 203 ‘<code class=property>fit-position</code>’ properties; they are
fantasai@5967 204 renamed to ‘<code class=property>object-fit</code>’ and ‘<code
fantasai@5967 205 class=property>object-position</code>’, redefined to enable additional
fantasai@5967 206 use cases, and moved to the <a
fantasai@2094 207 href="http://www.w3.org/TR/css3-images/">CSS3 Image Values and Replaced
simon@7289 208 Content module</a>. The page-page-margin box sizing algorithm has been
simon@7289 209 reworded to be a bit simpler, and many miscellaneous clarifications and
simon@7289 210 editorial improvements have been incorporated.
simon@6795 211
simon@6795 212 <p>Features at-risk (may be removed if they lack implementor interest):
fantasai@583 213
fantasai@583 214 <ul>
fantasai@1101 215 <li>comma-separated page selectors
fantasai@583 216 </ul>
fantasai@211 217
fantasai@2094 218 <p>Expected next revision to this document is another LCWD, due to the
simon@7289 219 substantive changes to page-margin box sizing and other areas that are
simon@7289 220 now specified with more precision.
fantasai@211 221
fantasai@1090 222 <p>The <a href="lc2_issues.htm">Disposition of Comments</a> document
fantasai@211 223 contains the current issues list and responses to input received during
simon@6795 224 this Last Call period.
fantasai@211 225
fantasai@213 226 <h2 class="no-num no-toc" id=contents>Table of Contents</h2>
fantasai@114 227 <!--begin-toc-->
fantasai@213 228 <ul class=toc>
fantasai@1626 229 <li><a href="#intro"><span class=secno>1. </span>Introduction</a>
fantasai@1626 230
fantasai@1626 231 <li><a href="#conformance"><span class=secno>2. </span>Conformance</a>
fantasai@1626 232
fantasai@1626 233 <li><a href="#page-terms"><span class=secno>3. </span>Page
fantasai@1626 234 Terminology</a>
fantasai@1626 235
fantasai@1626 236 <li><a href="#page-box-page-rule"><span class=secno>4. </span>The Page
fantasai@523 237 Model</a>
fantasai@213 238 <ul class=toc>
fantasai@6061 239 <li><a href="#painting"><span class=secno>4.1. </span> Page Backgrounds
fantasai@6061 240 and Painting Order</a>
fantasai@6061 241
fantasai@6061 242 <li><a href="#content-outside-box"><span class=secno>4.2.
fantasai@1626 243 </span>Content outside the page box</a>
fantasai@1626 244
fantasai@1626 245 <li><a href="#progression"><span class=secno>4.3. </span>Page
fantasai@528 246 Progression</a>
fantasai@528 247 </ul>
fantasai@528 248
fantasai@1626 249 <li><a href="#page-selector-and-context"><span class=secno>5. </span>Page
fantasai@528 250 Selectors and the Page Context</a>
fantasai@528 251 <ul class=toc>
fantasai@1626 252 <li><a href="#at-page-rule"><span class=secno>5.1. </span>The @page
fantasai@568 253 Rule</a>
fantasai@568 254
simon@7435 255 <li><a href="#pseudo-classes"><span class=secno>5.2. </span> Page
simon@7435 256 pseudo-classes: :left, :right, :first, and :blank </a>
fantasai@566 257
fantasai@1626 258 <li><a href="#syntax-page-selector"><span class=secno>5.3. </span>@page
fantasai@566 259 rule grammar</a>
fantasai@566 260
fantasai@1626 261 <li><a href="#cascading-and-page-context"><span class=secno>5.4.
fantasai@528 262 </span>Cascading in the page context</a>
fantasai@528 263 </ul>
fantasai@528 264
simon@7289 265 <li><a href="#margin-boxes"><span class=secno>6. </span>Page-Margin
simon@7289 266 Boxes</a>
fantasai@566 267 <ul class=toc>
fantasai@1626 268 <li><a href="#margin-at-rules"><span class=secno>6.1. </span>At-rules
simon@7289 269 for page-margin boxes</a>
fantasai@566 270
fantasai@1626 271 <li><a href="#populating-margin-boxes"><span class=secno>6.2.
simon@7289 272 </span>Populating page-margin boxes</a>
fantasai@566 273
fantasai@1626 274 <li><a href="#margin-box-dimensions"><span class=secno>6.3.
simon@7289 275 </span>Computing Page-margin Box Dimensions</a>
fantasai@566 276 <ul class=toc>
fantasai@1626 277 <li><a href="#max-margin-dimension"><span class=secno>6.3.1.
simon@7289 278 </span>Page-Margin Box Layout Terminology</a>
fantasai@566 279
fantasai@1626 280 <li><a href="#margin-dimension"><span class=secno>6.3.2.
simon@7289 281 </span>Page-Margin Box Variable Dimension Computation Rules</a>
simon@7053 282 <ul class=toc>
simon@7053 283 <li><a href="#marginbox-variabledim-margins"><span
simon@7053 284 class=secno>6.3.2.1. </span>Margins</a>
simon@7053 285
simon@7053 286 <li><a href="#marginbox-variabledim-with"><span
simon@7053 287 class=secno>6.3.2.2. </span>Resolving ‘<code
simon@7053 288 class=css>auto</code>’ widths</a>
simon@7053 289
simon@7054 290 <li><a href="#marginbox-variabledim-minmax"><span
simon@7054 291 class=secno>6.3.2.3. </span>Handling ‘<code
simon@7054 292 class=property>min-width</code>’ and ‘<code
simon@7054 293 class=property>max-width</code>’</a>
simon@7054 294
simon@7053 295 <li><a href="#marginbox-variabledim-positioning"><span
simon@7054 296 class=secno>6.3.2.4. </span>Positioning</a>
simon@7053 297
simon@7053 298 <li><a href="#marginbox-variabledim-others"><span
simon@7054 299 class=secno>6.3.2.5. </span>Boxes on other sides</a>
simon@7053 300 </ul>
fantasai@1626 301
fantasai@1626 302 <li><a href="#margin-constraints"><span class=secno>6.3.3.
simon@7289 303 </span>Page-Margin Box Fixed Dimension Computation Rules</a>
fantasai@566 304 </ul>
fantasai@566 305
simon@7289 306 <li><a href="#margin-box-ex"><span class=secno>6.4. </span>Page-margin
simon@7289 307 box examples</a>
fantasai@566 308 </ul>
fantasai@566 309
fantasai@1626 310 <li><a href="#page-properties"><span class=secno>7. </span>Page
fantasai@528 311 Properties</a>
fantasai@528 312 <ul class=toc>
fantasai@1626 313 <li><a href="#page-based-counters"><span class=secno>7.1.
fantasai@566 314 </span>Page-based counters</a>
fantasai@566 315
fantasai@1626 316 <li><a href="#margin-text-alignment"><span class=secno>7.2.
simon@7289 317 </span>Page-margin boxes and default values</a>
fantasai@566 318 </ul>
fantasai@566 319
fantasai@3574 320 <li><a href="#page-size"><span class=secno>8. </span>Page Size</a>
fantasai@566 321 <ul class=toc>
fantasai@1626 322 <li><a href="#page-size-prop"><span class=secno>8.1. </span>Page size:
fantasai@5967 323 the ‘<code class=property>size</code>’ property</a>
fantasai@213 324 <ul class=toc>
fantasai@1626 325 <li><a href="#some-examples"><span class=secno>8.1.1. </span>Some
fantasai@213 326 examples:</a>
fantasai@213 327
fantasai@1626 328 <li><a href="#page-size-media-query"><span class=secno>8.1.2.
fantasai@213 329 </span>Media Queries</a>
fantasai@114 330 </ul>
fantasai@213 331
fantasai@1626 332 <li><a href="#renderingpages"><span class=secno>8.2. </span>Rendering
fantasai@528 333 page boxes that do not fit a page sheet</a>
fantasai@528 334
fantasai@1626 335 <li><a href="#positioning-page-box"><span class=secno>8.3.
fantasai@528 336 </span>Positioning the page box on the sheet</a>
fantasai@114 337 </ul>
fantasai@213 338
simon@7430 339 <li><a href="#page-breaks"><span class=secno>9. </span> Page Breaks </a>
fantasai@213 340 <ul class=toc>
simon@7430 341 <li><a href="#using-named-pages"><span class=secno>9.1. </span>Using
fantasai@5967 342 named pages: ‘<code class=property>page</code>’</a>
fantasai@114 343 </ul>
fantasai@213 344
fantasai@1626 345 <li><a href="#image-properties"><span class=secno>10. </span>Image
fantasai@528 346 Properties</a>
fantasai@528 347
fantasai@563 348 <li class=no-num><a href="#properties-list">Appendix A: Applicable CSS2.1
fantasai@528 349 Properties</a>
fantasai@528 350 <ul class=toc>
fantasai@1052 351 <li class=no-num><a
fantasai@1052 352 href="#properties-that-apply-within-the-page-co">Properties that apply
fantasai@1052 353 within the page context</a>
fantasai@1052 354
fantasai@1052 355 <li class=no-num><a
fantasai@1052 356 href="#properties-that-apply-within-the-margin-">Properties that apply
fantasai@1052 357 within the margin contexts</a>
fantasai@114 358 </ul>
fantasai@213 359
fantasai@552 360 <li class=no-num><a href="#transfer-possibilities">Appendix B: Transfer
fantasai@552 361 Possibilities</a>
fantasai@552 362
fantasai@213 363 <li class=no-num><a href="#references">References</a>
fantasai@213 364 <ul class=toc>
fantasai@213 365 <li class=no-num><a href="#normative-references">Normative
fantasai@213 366 References</a>
fantasai@213 367
fantasai@213 368 <li class=no-num><a href="#informative-references">Informative
fantasai@213 369 References</a>
fantasai@114 370 </ul>
fantasai@114 371 </ul>
fantasai@114 372 <!--end-toc--> <!-- "Introduction" -->
fantasai@1626 373 <h2 id=intro><span class=secno>1. </span>Introduction</h2>
fantasai@213 374
fantasai@213 375 <p>Paged media (e.g., paper, transparencies, photo album pages, pages
fantasai@114 376 displayed on computer screens as printed output simulations) differ from
fantasai@5976 377 <a
fantasai@5976 378 href="http://www.w3.org/TR/CSS2/media.html#continuous-media-group">continuous
fantasai@5976 379 media</a> in that the content of the document is split into one or more
fantasai@5976 380 discrete static display surfaces. To handle pages, CSS3 Paged Media
simon@6795 381 describes how:
fantasai@114 382
fantasai@114 383 <ul>
fantasai@213 384 <li><a href="#page-breaks">page breaks</a> are created and avoided;
fantasai@211 385
fantasai@211 386 <li>the page properties such as size, orientation, margins, border, and
fantasai@213 387 padding are specified;
fantasai@213 388
fantasai@213 389 <li>headers and footers are established within the page margins;
fantasai@211 390
fantasai@211 391 <li>content such as page counters are placed in the headers and footers;
fantasai@213 392 and
fantasai@213 393
fantasai@213 394 <li>orphans and widows can be controlled.
fantasai@114 395 </ul>
fantasai@114 396
fantasai@213 397 <p>This module defines a <a href="#page-model">page model</a> that
fantasai@114 398 specifies how a document is formatted within a rectangular area, called
fantasai@211 399 the <a href="#page-box-page-rule">page box</a>, that has finite width and
fantasai@657 400 height.
fantasai@114 401
fantasai@213 402 <p>Although CSS3 does not specify how user agents transfer page boxes to
fantasai@114 403 sheets, it does include certain mechanisms for telling user agents about
fantasai@114 404 the intended page sheet <a href="#page-size">size and orientation</a>. In
fantasai@114 405 the general case, CSS3 assumes that one page box will be transferred to
simon@6795 406 one surface of similar size.
fantasai@114 407
fantasai@1052 408 <p>All properties defined in this specification also accept the <a
fantasai@1052 409 href="http://www.w3.org/TR/CSS21/cascade.html#value-def-inherit">inherit</a>
fantasai@1052 410 keyword as their value, but for readability it has not been listed
fantasai@1052 411 explicitly.
fantasai@1052 412
fantasai@1626 413 <h2 id=conformance><span class=secno>2. </span>Conformance</h2>
fantasai@213 414
fantasai@685 415 <p>All of the text in this specification is normative except sections
fantasai@685 416 explicitly marked as non-normative, examples, and notes. The keywords
fantasai@685 417 "<em class=RFC2119>MUST</em>", "<em class=RFC2119>SHALL</em>", "<em
fantasai@685 418 class=RFC2119>MUST NOT</em>", "<em class=RFC2119>SHALL NOT</em>", "<em
fantasai@685 419 class=RFC2119>REQUIRED</em>", "<em class=RFC2119>SHOULD</em>", "<em
fantasai@685 420 class=RFC2119>SHOULD NOT</em>", "<em class=RFC2119>RECOMMENDED</em>",
fantasai@685 421 "<em class=RFC2119>MAY</em>", and "<em class=RFC2119>OPTIONAL</em>" when
fantasai@685 422 used in this document are to be interpreted as described in <cite>RFC
fantasai@685 423 2119</cite> <a href="#RFC2119"
fantasai@213 424 rel=biblioentry>[RFC2119]<!--{{!RFC2119}}--></a>. However, for
fantasai@114 425 readability, these words do not appear in all uppercase letters in this
simon@6795 426 specification.
fantasai@522 427
fantasai@522 428 <p>Examples in this specification are introduced with the words "for
fantasai@522 429 example" or are set apart from the normative text with
fantasai@657 430 <code>class="example"</code>, like this:
fantasai@522 431
fantasai@522 432 <div class=example>
simon@6795 433 <p>This is an example of an informative example.
fantasai@522 434 </div>
fantasai@522 435
fantasai@522 436 <p>Informative notes begin with the word "Note" and are set apart from the
fantasai@657 437 normative text with <code>class="note"</code>, like this:
fantasai@522 438
simon@6795 439 <p class=note>Note, this is an informative note.
fantasai@522 440
fantasai@1626 441 <h2 id=page-terms><span class=secno>3. </span>Page Terminology</h2>
fantasai@213 442
fantasai@213 443 <p>The following terminology and accompanying diagrams help to describe
simon@6795 444 the page model:
fantasai@114 445
fantasai@114 446 <dl>
fantasai@213 447 <dt id=page-sheet>Page sheet
fantasai@213 448
fantasai@3574 449 <dd><img
fantasai@3574 450 alt="The corner of a page sheet with the non-printable area at the edge and printable area inside it"
fantasai@3574 451 height=148 src=PageSheet.png style="float: right;" width=194>The page
fantasai@3574 452 sheet is one surface of the physical medium. The illustration to the
fantasai@3574 453 right shows a representation of the upper-left corner of a page sheet.
fantasai@213 454
fantasai@213 455 <dt id=printable-area>Printable and non-printable areas
fantasai@213 456
fantasai@213 457 <dd>The non-printable area is the area of a page sheet that a physical
fantasai@114 458 device such as a printer is not capable of marking reliably, usually due
fantasai@114 459 to the printer's paper handling mechanism. This value is printer
fantasai@114 460 dependent and is usually a small region along each edge of the page
fantasai@114 461 sheet. The printable area is the area of page sheet that a printer
fantasai@114 462 <em>is</em> capable of marking reliably. The size of the printable area
fantasai@114 463 is the size of the page sheet reduced by the size of the non-printable
fantasai@114 464 area. A user agent may not know the dimensions of this area for a
fantasai@114 465 particular printing device; but when its dimensions are known, user
fantasai@213 466 agents <em class=RFC2119>MAY</em> adjust the formatting of the document
fantasai@213 467 so that content falls within the printable area. How this adjustment is
fantasai@213 468 accomplished is device dependent within the constraints expressed in the
fantasai@213 469 sections <a href="#renderingpages">Rendering page boxes that do not fit
fantasai@213 470 a page sheet</a> and <a href="#content-outside-box">Content outside the
fantasai@213 471 page box</a>.
fantasai@213 472
fantasai@213 473 <dt id=page-orientation>Page Orientation
fantasai@213 474
fantasai@213 475 <dd>The page orientation is defined by comparing the length of the edges
fantasai@114 476 of a <a href="#page-box">page box</a>. The page box is a rectangle with
fantasai@114 477 two perpendicular edges called the long edge and the short edge. The
fantasai@114 478 length of the long edge is always greater than or equal to the length of
fantasai@114 479 the short edge. When the page box is square, the two edges are of the
fantasai@114 480 same length and either can be used as the long edge with the other being
fantasai@5967 481 the short edge. This specification defines page orientations of ‘<code
fantasai@5967 482 class=property>portrait</code>’ and ‘<code
fantasai@5967 483 class=property>landscape</code>’.
fantasai@213 484
fantasai@213 485 <dt id=portrait>Portrait Orientation
fantasai@213 486
fantasai@213 487 <dd>A portrait page's height is greater than or equal to its width.
fantasai@114 488 Horizontal elements are parallel to the short edge and vertical elements
fantasai@213 489 to the long edge.
fantasai@213 490
fantasai@213 491 <dt id=landscape>Landscape Orientation
fantasai@213 492
fantasai@213 493 <dd>A landscape page's width is greater than or equal to its height.
fantasai@114 494 Horizontal elements are parallel to the long edge and vertical elements
fantasai@1136 495 to the short edge. <span class=note>Note that CSS3 makes no distinction
fantasai@1136 496 between landscape and reverse-landscape orientations. However, future
fantasai@1136 497 versions of CSS may do so. UAs should consider, when formatting for
fantasai@1136 498 duplexed printing, the binding edge, page progression, and ease of
fantasai@1136 499 reading when choosing between landscape and reverse-landscape
fantasai@1136 500 renderings.</span>
fantasai@213 501
fantasai@213 502 <dt id=duplex-printing>Duplex Printing
fantasai@213 503
fantasai@213 504 <dd>Duplex printing prints one page box per side of a page sheet and uses
fantasai@213 505 both sides of the page sheet. This module provides no ability to specify
fantasai@213 506 whether a document is duplex printed, but the concept of left and right
fantasai@213 507 pages is based on the assumption that the document is duplex printed,
fantasai@213 508 regardless of whether or not it actually is.
fantasai@213 509
fantasai@213 510 <dt id=binding-edge>Binding Edge
fantasai@213 511
fantasai@213 512 <dd>The binding edge is the edge of the page box that is toward the
fantasai@114 513 binding if the material is bound. The binding edge often has a larger
fantasai@114 514 margin than the opposite edge to provide for the space used by the
fantasai@114 515 binding. The binding edge can be any of the four edges. However, page
fantasai@114 516 sheets are customarily bound so that the binding edge of page boxes with
fantasai@114 517 portrait orientation is vertical. This module provides no method to
fantasai@114 518 specify the binding edge. In duplex printing, the binding edge is on
fantasai@213 519 opposite sides of the page box for the left and right pages.
fantasai@213 520
fantasai@213 521 <dt id=facing-pages>Facing Pages
fantasai@213 522
fantasai@213 523 <dd>Facing pages are two sequential pages such that when the document is
fantasai@114 524 duplex printed they are on separate sheets of paper. Typically, the
fantasai@114 525 earlier page will be the back side of one sheet and the later page will
fantasai@114 526 be the front side of another. They are usually laid out so that the
fantasai@114 527 binding edges of facing pages are vertical and adjacent when the pages
fantasai@213 528 are placed in their normal reading orientation.
fantasai@213 529
fantasai@213 530 <dt id=left-page>Left Page
fantasai@213 531
fantasai@526 532 <dd>A page that would be on the left if it is part of a pair of facing
fantasai@114 533 pages as typically laid out. Page layouts for documents using a
fantasai@114 534 left-to-right page progression have the earlier of the facing pages on
fantasai@114 535 the left. Rules specific to the left page can be specified using the
fantasai@5967 536 <span class=css>‘<code class=css>:left</code>’</span> page selector.
fantasai@213 537
fantasai@213 538 <dt id=right-page>Right Page
fantasai@213 539
fantasai@526 540 <dd>A page that would be on the right if it is part of a pair of facing
fantasai@114 541 pages as typically laid out. Page layouts for documents using a
fantasai@114 542 right-to-left page progression have the earlier of the facing pages on
fantasai@114 543 the right. Rules specific to the right page can be specified using the
fantasai@5967 544 <span class=css>‘<code class=css>:right</code>’</span> page
fantasai@517 545 selector.
fantasai@114 546 </dl>
fantasai@526 547
fantasai@1626 548 <h2 id=page-box-page-rule><span class=secno>4. </span>The Page Model</h2>
fantasai@564 549
fantasai@564 550 <p>In the paged media formatting model, the document is transferred into
fantasai@564 551 one or more page boxes. The <dfn id=page-box>page box</dfn> is a
fantasai@564 552 specialized CSS box that maps to a rectangular print media surface, such
fantasai@564 553 as a page of paper. It is roughly analogous to the <a
fantasai@5976 554 href="http://www.w3.org/TR/CSS21/visuren.html#viewport">viewport</a>.
fantasai@5976 555 <img alt="" height=266 src=PageBox.png style="float: right;" width=267>
fantasai@5976 556
fantasai@5976 557 <p>As with other CSS <a
fantasai@5976 558 href="http://www.w3.org/TR/CSS21/box.html">boxes</a>, a page box consists
fantasai@5976 559 of margin, border, padding, and content areas. The content and margin
simon@6795 560 areas of a page box have special functions:
fantasai@564 561
fantasai@564 562 <ul>
fantasai@564 563 <li>The content area of a page box is called the <dfn id=page-area>page
fantasai@564 564 area</dfn>. The content of the document is flowed into one or more page
fantasai@564 565 boxes. The page area acts as a container for all the boxes generated by
fantasai@564 566 the root element and its descendants that are laid out within a given
fantasai@564 567 page box. The edges of the page area on the first page establish the
fantasai@564 568 rectangle that is the initial <a
fantasai@5976 569 href="http://www.w3.org/TR/CSS21/visudet.html#containing-block-details">containing
fantasai@564 570 block</a> of the document.
fantasai@564 571
fantasai@564 572 <li>The margin area of a page box is divided into 16 <dfn
simon@7289 573 id=page-margin-boxes>page-margin boxes</dfn>. Each page-margin box has
simon@7289 574 its own margin, border, padding and content areas. Page-margin boxes are
simon@7289 575 typically used to display running headers and footers.
fantasai@564 576 </ul>
fantasai@564 577
fantasai@5973 578 <p>The properties of a <a href="#page-box"><i>page box</i></a> are
fantasai@5973 579 determined by properties <a
fantasai@5976 580 href="http://www.w3.org/TR/CSS21/syndata.html#declaration">declared</a>
fantasai@5976 581 within the <a href="#page-context"><i>page context</i></a>, which is the
fantasai@5976 582 <a href="http://www.w3.org/TR/CSS21/syndata.html#x14">declaration
simon@6957 583 block</a> of the <code>@page</code> rule. Similarly the properties of a
simon@7289 584 <i>page-margin box</i> are determined by properties declared within its
simon@7289 585 <a href="#margin-context"><i>margin context</i></a>. Declarations in the
simon@7289 586 page context can affect the page box and/or inherit to the page-margin
simon@7289 587 boxes, but they do not apply to or inherit into the document's root
simon@7289 588 element or other content.
fantasai@5973 589
fantasai@5973 590 <p>The <a href="#containing-block0"><i>containing block</i></a> of the
fantasai@5973 591 page box is specified using the ‘<a href="#size"><code
fantasai@5973 592 class=property>size</code></a>’ property in the <a
fantasai@5973 593 href="#page-context"><i>page context</i></a>. The width and horizontal
fantasai@5973 594 margins of the page box are then calculated exactly as for a <a
fantasai@5973 595 href="http://www.w3.org/TR/CSS21/visudet.html#blockwidth">non-replaced
fantasai@5973 596 block element in normal flow</a>. <a href="#CSS21"
fantasai@5973 597 rel=biblioentry>[CSS21]<!--{{!CSS21}}--></a> The height and vertical
fantasai@5973 598 margins of the page box are calculated analogously (instead of using the
fantasai@5973 599 block height formulas). In both cases if the values are over-constrained,
fantasai@5973 600 instead of ignoring any margins, the containing block is resized to
fantasai@5973 601 coincide with the margin edges of the page box.
fantasai@564 602
fantasai@6061 603 <h3 id=painting><span class=secno>4.1. </span> Page Backgrounds and
fantasai@6061 604 Painting Order</h3>
fantasai@6061 605
fantasai@6061 606 <p>When drawing a page of content, the page layers are painted in the
fantasai@6061 607 following painting order (bottommost first):
fantasai@6061 608
fantasai@6061 609 <ol>
fantasai@6061 610 <li>page background
fantasai@6061 611
fantasai@6061 612 <li>document canvas
fantasai@6061 613
fantasai@6061 614 <li>page borders
fantasai@6061 615
fantasai@6061 616 <li>document contents
fantasai@6061 617
simon@7289 618 <li>page-margin boxes
fantasai@6061 619 </ol>
fantasai@6061 620
fantasai@6061 621 <p>In the page model, the page background behaves similar to the root
fantasai@6061 622 background: its <a
fantasai@6061 623 href="http://www.w3.org/TR/css3-background/#background-painting-area"><i>background
fantasai@6065 624 painting area</i></a> is the entire page box, including its margins. Page
fantasai@6065 625 backgrounds are anchored within the page box's padding area by default
fantasai@6065 626 (and honor ‘<code class=property>background-origin</code>’ if the UA
fantasai@6065 627 supports <a href="#CSS3BG"
fantasai@6065 628 rel=biblioentry>[CSS3BG]<!--{{!CSS3BG}}--></a>). However if ‘<code
fantasai@6065 629 class=property>background-attachment</code>’ is ‘<code
fantasai@6061 630 class=css>fixed</code>’ then the image is positioned relative to the
fantasai@6061 631 page box including its margins (i.e. the <a
fantasai@6061 632 href="http://www.w3.org/TR/css3-background/#background-positioning-area"><i>background
fantasai@6061 633 positioning area</i></a>, like the <i>background painting area</i>, is
fantasai@6061 634 the page's margin box).
fantasai@6061 635
fantasai@6061 636 <p>The document canvas background is drawn as the page box's background:
fantasai@6065 637 by default its <i>background painting area</i> covers the page box's
fantasai@6065 638 border box, and for UAs that support <a href="#CSS3BG"
fantasai@6064 639 rel=biblioentry>[CSS3BG]<!--{{!CSS3BG}}--></a>, follows the ‘<code
fantasai@6061 640 class=property>background-clip</code>’ value specified on the root
fantasai@6064 641 element. It remains, however, positioned with respect to the root element
fantasai@6064 642 or page area as usual.
fantasai@6061 643
simon@7289 644 <p>The UA may support the <code>z-index</code> property for page-margin
simon@7289 645 boxes. With respect to the page-margin boxes, the document canvas, page
simon@7289 646 borders, and all of the document contents are treated as a single element
simon@7289 647 with a <code>z-index</code> value of ‘<code class=css>0</code>’: the
simon@7289 648 page-margin boxes never interleave with parts of the document content or
simon@7289 649 between the content and the canvas. They may only paint in front of the
simon@7289 650 document content or behind the document canvas. The page background is
simon@7289 651 always painted underneath everything else. Since the
simon@7289 652 <code>position</code> property does not apply to page-margin boxes,
simon@7289 653 <code>z-index</code> always affects page-margin boxes as if they were
simon@7289 654 positioned elements regardless of the <code>position</code> property's
simon@7289 655 value.
fantasai@6061 656
fantasai@6061 657 <p>The default painting order, or <a
fantasai@6061 658 href="http://www.w3.org/TR/CSS21/zindex.html">CSS2.1 Appendix E</a> "tree
simon@7289 659 order", of page-margin boxes with respect to each other is not specified.
simon@7289 660 However, the page-margin boxes are defined to come after the page box and
simon@7289 661 its contents. <span class=issue>Suggestions here are welcome.</span>
fantasai@6061 662
fantasai@6061 663 <h3 id=content-outside-box><span class=secno>4.2. </span>Content outside
fantasai@528 664 the page box</h3>
fantasai@528 665
fantasai@528 666 <p>When formatting content in the page model, some content may end up
fantasai@5967 667 outside the page box. For example, an element whose ‘<code
fantasai@5967 668 class=property>white-space</code>’ property has the value ‘<code
fantasai@5967 669 class=property>pre</code>’ can generate a box that is wider than the
fantasai@5967 670 page box. As another example, when boxes are positioned absolutely or
fantasai@5967 671 relatively, they may end up in "inconvenient" locations. For example,
fantasai@5967 672 images may be placed on the edge of the page box or 100,000 meters below
simon@6795 673 the page box.
fantasai@528 674
fantasai@528 675 <p>A specification for the exact formatting of such elements lies outside
fantasai@528 676 the scope of this document. However, it is recommended that authors and
fantasai@528 677 user agents observe the following general principles concerning content
simon@6795 678 outside the page box:
fantasai@528 679
fantasai@528 680 <ul>
fantasai@565 681 <li>
fantasai@1134 682 <p>Content should be allowed slightly beyond the page box to allow pages
fantasai@1134 683 to "bleed".
fantasai@1134 684
fantasai@1134 685 <li>
fantasai@565 686 <p>User agents <em class=RFC2119>SHOULD</em> avoid generating a large
fantasai@565 687 number of content-empty pages to honor the positioning of elements
fantasai@565 688 (e.g., printing 100 blank pages is probably neither the author's nor
fantasai@565 689 the user's intent). A <dfn id=content-empty>Content-empty page</dfn> is
fantasai@565 690 a page box whose page area contains no printable content other than
fantasai@565 691 backgrounds and/or borders. A page box whose page area contains
fantasai@5967 692 generated content, or content whose visibility is ‘<code
fantasai@5967 693 class=property>hidden</code>’, or invisible content such as a
fantasai@565 694 zero-width space is not a content-empty page. On the other hand, a page
simon@7289 695 containing only a background and/or borders and/or page-margin box
simon@7289 696 content <em>is</em> a content-empty page.
fantasai@565 697
fantasai@565 698 <p class=note>Note, however, that generating a small number of empty
fantasai@5967 699 page boxes is sometimes necessary to honor the <span class=css>‘<code
fantasai@5967 700 class=property>left</code>’</span> and <span class=css>‘<code
simon@7430 701 class=property>right</code>’</span> values for <span
simon@7430 702 class=property>‘<code
simon@7430 703 class=property>page-break-before</code>’</span> and <span
simon@7430 704 class=property>‘<code
simon@7430 705 class=property>page-break-after</code>’</span>.
fantasai@565 706
fantasai@565 707 <li>
fantasai@565 708 <p>Authors <em class=RFC2119>SHOULD NOT</em> position elements in
fantasai@657 709 inconvenient locations just to avoid rendering them. Instead:
fantasai@565 710
fantasai@528 711 <ul>
fantasai@528 712 <li>To suppress box generation entirely, set the <span
fantasai@5967 713 class=property>‘<code class=property>display</code>’</span>
fantasai@5967 714 property to <span class=css>‘<code
fantasai@5967 715 class=property>none</code>’</span>.
fantasai@5967 716
fantasai@5967 717 <li>To make a box invisible, set the <span class=property>‘<code
fantasai@5967 718 class=property>visibility</code>’</span> property.
fantasai@528 719 </ul>
fantasai@528 720
fantasai@565 721 <li>
fantasai@565 722 <p>This specification does not define how boxes positioned outside the
fantasai@565 723 page box are handled. Possibilities include discarding them or creating
fantasai@657 724 page boxes for them at the end of the document.
fantasai@528 725 </ul>
fantasai@565 726
fantasai@1626 727 <h3 id=progression><span class=secno>4.3. </span>Page Progression</h3>
fantasai@526 728
fantasai@526 729 <p>CSS distinguishes between left pages and right pages on all documents,
fantasai@526 730 whether they are printed duplex or not. Each left page is followed by a
fantasai@526 731 right page and vice versa. Left and right pages can be styled differently
fantasai@526 732 with the <a href="#left-right-first"><code>:left</code> and
fantasai@657 733 <code>:right</code> pseudo-classes</a>.
fantasai@526 734
fantasai@526 735 <p>Whether the first page of a document is a left page or a right page
fantasai@526 736 depends on the page progression of the document. The <dfn
fantasai@526 737 id=page-progression>page progression</dfn> is the direction in which the
fantasai@526 738 printed pages of a document would be sequenced when laid out
fantasai@557 739 side-to-side. For example, English and horizontally-set Japanese
fantasai@557 740 typically progress from left to right, whereas Arabic and vertically-set
fantasai@5987 741 Japanese pages typically progress from right to left. In documents with a
fantasai@5987 742 left-to-right page progression the first page of the document is a right
simon@6795 743 page, and vice versa.
simon@6795 744
simon@6795 745 <p>The page progression direction is determined as follows:
fantasai@526 746
fantasai@526 747 <ul>
fantasai@526 748 <li>If text is laid out in horizontal lines, the page progression is the
fantasai@526 749 same as the inline progression.
fantasai@526 750
fantasai@526 751 <li>If text is laid out in vertical lines, the page progression is the
fantasai@526 752 same as the block progression.
fantasai@526 753 </ul>
fantasai@526 754
fantasai@5967 755 <p>If the UA supports the ‘<code class=property>direction</code>’ and
fantasai@5975 756 ‘<code class=property>writing-mode</code>’ properties from the CSS 3
fantasai@5975 757 Writing Modes Module <a href="#CSS3-WRITING-MODES"
fantasai@5975 758 rel=biblioentry>[CSS3-WRITING-MODES]<!--{{CSS3-WRITING-MODES}}--></a>, it
fantasai@5975 759 must <a
fantasai@5975 760 href="http://www.w3.org/TR/css3-writing-modes/#page-direction">determine</a>
fantasai@5975 761 whether the first page is a left or right page from the values of those
simon@6795 762 properties on the root element.
fantasai@526 763
fantasai@526 764 <p>To explicitly force a document to begin printing on a left or right
fantasai@526 765 page, authors can <a href="#page-break-before">insert a page break
fantasai@526 766 before</a> the first generated box. The UA must suppress the first
fantasai@526 767 (empty) page(s) in this case (and the <code>:first</code> selector
simon@6795 768 applies to the first printed page).
fantasai@526 769
simon@7334 770 <div class=example>
simon@7334 771 <pre>
simon@7334 772 html { page-break-before: always }
simon@7334 773 </pre>
simon@7334 774
simon@7334 775 <p> For an HTML document with a left-to-right page progression, the above
simon@7334 776 style rule will cause the first page of the document to print on a
simon@7334 777 ‘<code class=css>:left</code>’ page
simon@7334 778
simon@7334 779 <pre>
simon@7334 780 html { page-break-before: left }
simon@7334 781 </pre>
simon@7334 782
simon@7334 783 <p> For an HTML document, the above style rule will cause the first page
simon@7334 784 of the document to print on a ‘<code class=css>:left</code>’ page,
simon@7334 785 regardless of the page progression.
simon@7334 786 </div>
simon@7334 787
fantasai@1626 788 <h2 id=page-selector-and-context><span class=secno>5. </span>Page
fantasai@1626 789 Selectors and the Page Context</h2>
fantasai@1626 790
fantasai@1626 791 <h3 id=at-page-rule><span class=secno>5.1. </span>The @page Rule</h3>
fantasai@568 792
fantasai@557 793 <p>Authors can specify various aspects of a page box, such as its
simon@6957 794 dimensions, orientation, and margins, within an <span
simon@6957 795 class=css>@page</span> rule. An <span class=css>@page</span> rule
simon@6957 796 consists of the keyword <span class=css>‘<code
simon@7290 797 class=css>@page</code>’</span>, an <em class=RFC2119>OPTIONAL</em>
simon@7290 798 comma-separated list of <a href="#page-selector"><i
simon@7290 799 title="page selector">page selectors</i></a> and a block of declarations
simon@7290 800 (said to be in the <dfn id=page-context>page context</dfn>). <a
simon@7290 801 href="#margin-at-rules">Margin at-rules</a> may be interleaved with the
simon@7290 802 declarations in the page context.
simon@7290 803
simon@7290 804 <p>A <dfn id=page-selector>page selector</dfn> is either a page
simon@7290 805 pseudo-class, or a page name followed with no intervening whitespace by
simon@7290 806 an <em class=RFC2119>OPTIONAL</em> page pseudo-class. The page selector
simon@7290 807 specifies for which pages the declarations apply. In CSS3, page selectors
simon@7290 808 can designate the first page of a document, all left pages, all right
simon@7290 809 pages, or <a href="#using-named-pages">pages with specific names</a>.
simon@7290 810 Multiple selectors may be combined with a comma (which may be preceded
simon@7290 811 and/or followed by white space); in this case the ‘<code
simon@6957 812 class=css>@page</code>’ rule applies to pages that match any of the
fantasai@5967 813 page selectors. (Note: this feature is at-risk.) If no page selector is
simon@6957 814 given, then the ‘<code class=css>@page</code>’ rule applies to all
simon@6957 815 pages.
simon@6795 816
simon@6795 817 <p>Properties declared within the page context apply to the page box.
fantasai@213 818
fantasai@213 819 <p>If an error is encountered during the processing of a declaration block
fantasai@213 820 within a page or a margin context, the <a
fantasai@5976 821 href="http://www.w3.org/TR/CSS21/syndata.html#parsing-errors">Rules for
fantasai@5976 822 handling parsing errors</a> apply; that is, valid declarations within the
simon@6795 823 block are applied.
fantasai@114 824
simon@7435 825 <h3 id=pseudo-classes><span class=secno>5.2. </span> <a
simon@7435 826 id=left-right-first></a> Page pseudo-classes: :left, :right, :first, and
simon@7435 827 :blank</h3>
simon@7435 828
simon@7435 829 <p> When printing double-sided documents, left and right pages are often
fantasai@566 830 formatted differently. This can be expressed through CSS pseudo-classes
simon@6795 831 defined in the <a href="#page-context">page context</a>.
fantasai@566 832
simon@7435 833 <p> All pages are automatically classified by user agents as either left
simon@7435 834 pages or right pages, based on <a href="#progression">page
simon@7435 835 progression</a>. The <span class=css>‘<code
fantasai@5967 836 class=css>:left</code>’</span> and <span class=css>‘<code
fantasai@5967 837 class=css>:right</code>’</span> page pseudo-classes can be used to
simon@6795 838 selectively apply rules to only the left or right pages, respectively.
fantasai@566 839
fantasai@566 840 <div class=example> The following example creates left and right binding
fantasai@566 841 edges using these pseudo-classes:
fantasai@566 842 <pre>
fantasai@566 843 @page :left {
fantasai@566 844 margin-left: 3cm;
fantasai@566 845 margin-right: 4cm;
fantasai@566 846 }
fantasai@566 847
fantasai@566 848 @page :right {
fantasai@566 849 margin-left: 4cm;
fantasai@566 850 margin-right: 3cm;
fantasai@566 851 }
fantasai@566 852 </pre>
fantasai@566 853 </div>
fantasai@566 854
fantasai@566 855 <p>If different declarations have been given for left and right pages, the
fantasai@566 856 user agent <em class=RFC2119>MUST</em> honor these declarations even if
fantasai@566 857 the user agent does not transfer the page boxes to left and right sheets
fantasai@566 858 (i.e., a printer that only prints on one side of the medium must
simon@6795 859 nevertheless produce correctly formatted output).
fantasai@566 860
fantasai@566 861 <div class=note>
simon@7334 862 <p> <em><strong>Note.</strong> Adding declarations to the <span
fantasai@5967 863 class=css>‘<code class=css>:left</code>’</span> or <span
fantasai@5967 864 class=css>‘<code class=css>:right</code>’</span> pseudo-class does
fantasai@5967 865 not necessarily influence whether the document comes out of the printer
fantasai@5967 866 double- or single-sided (which is outside the scope of this
simon@6795 867 specification).</em>
fantasai@566 868 </div>
fantasai@566 869
simon@7334 870 <p>Authors can also specify style for the first page of a document with
simon@7334 871 the <span class=css>‘<code class=css>:first</code>’</span>
simon@7334 872 pseudo-class. Such style rules are applied only to the first printed page
simon@7334 873 of a document.
simon@7334 874
simon@7334 875 <div class=example>
simon@7334 876 <pre>
simon@7334 877 @page { margin: 2cm } /* All margins set to 2cm */
simon@7334 878
simon@7334 879 @page :first {
simon@7334 880 margin-top: 10cm /* Top margin on first page 10cm */
simon@7334 881 }
simon@7334 882 </pre>
simon@7334 883 </div>
simon@7334 884
simon@7435 885 <p> Blank pages that appear as a result of <a
simon@7435 886 href="http://www.w3.org/TR/css3-break/#forced-breaks">forced page
simon@7435 887 breaks</a> can be styled with the <code>:blank</code> pseudo-class.
simon@7435 888
simon@7435 889 <div class=example>
simon@7435 890 <p>In this example, forced page break may occur before <code>h1</code>
simon@7435 891 elements.
simon@7435 892
simon@7435 893 <pre>
simon@7435 894 h1 { page-break-before: left }
simon@7435 895
simon@7435 896 @page :blank {
simon@7435 897 @top-center { content: "This page is intentionally left blank" }
simon@7435 898 }
simon@7435 899 </pre>
simon@7435 900 </div>
simon@7435 901
simon@7435 902 <p> A page matched by <code>:blank</code> can also be matched by other
simon@7435 903 page pseudo-classes.
simon@7435 904
simon@7435 905 <div class=example>
simon@7435 906 <p>If headers have been specified on all right pages, a blank right page
simon@7435 907 will be matched by both <code>:blank</code> and <code>:right</code>.
simon@7435 908 Therefore, margin boxes set on right pages will have to be removed
simon@7435 909 unless they are wanted on blank pages. Here is an example where the top
simon@7435 910 center header is removed from blank pages, while the page number
simon@7435 911 remains:
simon@7435 912
simon@7435 913 <pre>
simon@7435 914 h1 { page-break-before: left }
simon@7435 915
simon@7435 916 @page :blank {
simon@7435 917 @top-center { content: none }
simon@7435 918 }
simon@7435 919
simon@7435 920 @page :right {
simon@7435 921 @top-center { content: "Preliminary edition" }
simon@7435 922 @bottom-center { content: counter(page) }
simon@7435 923 }
simon@7435 924 </pre>
simon@7435 925
simon@7435 926 <p>Due to the higher specificity of <code>:blank</code> over
simon@7435 927 <code>:right</code>, the top center header is removed even if
simon@7435 928 <code>content: none</code> comes before <code>content: "Preliminary
simon@7435 929 edition"</code>.
simon@7435 930 </div>
simon@7435 931
fantasai@566 932 <div class=note>
fantasai@566 933 <p><em><strong>Note.</strong> Future versions of CSS may include other
simon@6795 934 page pseudo-classes.</em>
fantasai@566 935 </div>
fantasai@566 936
fantasai@1626 937 <h3 id=syntax-page-selector><span class=secno>5.3. </span>@page rule
fantasai@528 938 grammar</h3>
fantasai@213 939
fantasai@566 940 <p>The syntax for the @page rule is a specialization of the generic
annevk@150 941 at-rule defined by CSS 2.1. This grammar extends the at-rule syntax to
fantasai@566 942 allow @page rules nested inside @media rules. User agents <em
simon@6795 943 class=RFC2119>MUST</em> adhere to the following grammar:
fantasai@213 944
fantasai@213 945 <p>See <a href="#CSS21" rel=biblioentry>[CSS21]<!--{{!CSS21}}--></a>,
simon@6795 946 Section 4.1.1 and Appendix G for the expansion of missing productions:
fantasai@114 947
fantasai@213 948 <p id=specializatons-of-ATKEYWORD> All new lexical tokens are
simon@6795 949 specializations of the ATKEYWORD lexical token:
fantasai@114 950
fantasai@213 951 <pre class=lexical>
fantasai@213 952 PAGE_SYM ::= "@page"
fantasai@213 953 TOPLEFTCORNER_SYM ::= "@top-left-corner"
fantasai@213 954 TOPLEFT_SYM ::= "@top-left"
fantasai@213 955 TOPCENTER_SYM ::= "@top-center"
fantasai@213 956 TOPRIGHT_SYM ::= "@top-right"
fantasai@213 957 TOPRIGHTCORNER_SYM ::= "@top-right-corner"
simon@6957 958 BOTTOMLEFTCORNER_SYM ::= "@bottom-left-corner"
fantasai@213 959 BOTTOMLEFT_SYM ::= "@bottom-left"
fantasai@213 960 BOTTOMCENTER_SYM ::= "@bottom-center"
fantasai@213 961 BOTTOMRIGHT_SYM ::= "@bottom-right"
fantasai@213 962 BOTTOMRIGHTCORNER_SYM ::= "@bottom-right-corner"
fantasai@213 963 LEFTTOP_SYM ::= "@left-top"
fantasai@213 964 LEFTMIDDLE_SYM ::= "@left-middle"
fantasai@213 965 LEFTBOTTOM_SYM ::= "@left-bottom"
fantasai@213 966 RIGHTTOP_SYM ::= "@right-top"
fantasai@213 967 RIGHTMIDDLE_SYM ::= "@right-middle"
fantasai@213 968 RIGHTBOTTOM_SYM ::= "@right-bottom"
fantasai@213 969
fantasai@3574 970 <span
simon@6957 971 id=syntax-prod-media>media</span> :
fantasai@213 972 MEDIA_SYM S* medium [ COMMA S* medium ]* LBRACE S* [ page | ruleset ]* '}' S*
fantasai@213 973 ;
fantasai@213 974
fantasai@3574 975 <a
fantasai@3574 976 href="#page" id=syntax-prod-page>page</a> :
simon@7290 977 PAGE_SYM S* [ page_selector S* [ ',' page_selector S* ]* ]?
simon@7289 978 '{' S* [ [ declaration? ';' S* ] | page_margin_box ]* [ declaration ]? '}' S*
fantasai@213 979 ;
fantasai@3574 980 <span
simon@7290 981 id=syntax-prod-page-selector>page_selector</span> :
simon@7290 982 pseudo_page | IDENT pseudo_page?
simon@7290 983 ;
fantasai@3574 984 <span
fantasai@3574 985 id=syntax-prod-pseudo-page>pseudo_page</span> :
simon@7435 986 ':' [ "left" | "right" | "first" | "blank" ]
fantasai@213 987 ;
fantasai@213 988
fantasai@3574 989 <span
simon@7289 990 id=syntax-prod-margin>page_margin_box</span> :
fantasai@5973 991 margin_sym S* '{' S* declaration? [ ';' S* declaration? ]* '}' S*
fantasai@213 992 ;
fantasai@213 993
fantasai@3574 994 <span
fantasai@3574 995 id=syntax-prod-margin-sym>margin_sym</span> :
simon@6957 996 TOPLEFTCORNER_SYM |
simon@6957 997 TOPLEFT_SYM |
simon@6957 998 TOPCENTER_SYM |
simon@6957 999 TOPRIGHT_SYM |
fantasai@213 1000 TOPRIGHTCORNER_SYM |
simon@6957 1001 BOTTOMLEFTCORNER_SYM |
simon@6957 1002 BOTTOMLEFT_SYM |
simon@6957 1003 BOTTOMCENTER_SYM |
fantasai@213 1004 BOTTOMRIGHT_SYM |
fantasai@213 1005 BOTTOMRIGHTCORNER_SYM |
fantasai@213 1006 LEFTTOP_SYM |
fantasai@213 1007 LEFTMIDDLE_SYM |
fantasai@213 1008 LEFTBOTTOM_SYM |
fantasai@213 1009 RIGHTTOP_SYM |
fantasai@213 1010 RIGHTMIDDLE_SYM |
simon@6957 1011 RIGHTBOTTOM_SYM
fantasai@213 1012 ;
fantasai@211 1013 </pre>
fantasai@211 1014
fantasai@5967 1015 <p id=page-selector-syntax-restrict> The value ‘<code
fantasai@5967 1016 class=property>auto</code>’ is not a valid page name and must be
fantasai@1101 1017 treated as matching nothing.
fantasai@114 1018
fantasai@213 1019 <div class=example>
fantasai@213 1020 <p>The following are examples of page selectors (declaration block
simon@6795 1021 intentionally left blank)
fantasai@114 1022
fantasai@213 1023 <pre>
fantasai@213 1024 @page { ... }
fantasai@213 1025 @page :left { ... }
fantasai@213 1026 @page :right { ... }
fantasai@213 1027 @page LandscapeTable { ... }
fantasai@213 1028 @page CompanyLetterHead:first { ... } /* identifier and pseudo page. */
fantasai@213 1029 @page:first { ... };
fantasai@114 1030 </pre>
fantasai@114 1031
simon@7289 1032 <p>The following are examples of page-margin boxes where the declaration
simon@6795 1033 blocks are intentionally left blank.
fantasai@114 1034
fantasai@213 1035 <pre>
fantasai@213 1036 @page {
fantasai@213 1037 @top-left { ... /* document name */ }
fantasai@213 1038 @bottom-center { ... /* page number */}
fantasai@213 1039 }
fantasai@213 1040 @page :left { @left-middle { ... /* page number in left margin */ }}
fantasai@213 1041 @page :right{ @right-middle { ... /* page number in right margins of right pages */}}
fantasai@213 1042
fantasai@213 1043 @page :left { @bottom-left-corner { ... /* left page numbers */ }}
fantasai@213 1044 @page :right { @bottom-right-corner { ... /* right page numbers */ }}
fantasai@213 1045 @page :first { @bottom-left-corner { ... /* empty footer on 1st page */ }
fantasai@213 1046 @bottom-right-corner { ... /* empty footer */ } }
fantasai@114 1047 </pre>
fantasai@114 1048 </div>
fantasai@114 1049
fantasai@1626 1050 <h3 id=cascading-and-page-context><span class=secno>5.4. </span>Cascading
fantasai@528 1051 in the page context</h3>
fantasai@213 1052
fantasai@213 1053 <p>Declarations in page and margin contexts <a
fantasai@5976 1054 href="http://www.w3.org/TR/CSS21/cascade.html">cascade</a> just like
fantasai@5976 1055 declarations in <a
simon@6795 1056 href="http://www.w3.org/TR/CSS21/syndata.html#rule-sets">rule sets</a>.
fantasai@114 1057
fantasai@1101 1058 <p>The specificity of page selectors is computed in a manner analogous to
fantasai@1101 1059 the computations defined in the <a
simon@6795 1060 href="http://www.w3.org/TR/CSS21/selector.html">Selectors</a> module:
fantasai@114 1061
fantasai@114 1062 <ul>
fantasai@1101 1063 <li>if the page selector has a named page, f=1; else f=0
fantasai@1101 1064
simon@7435 1065 <li>if the page selector has a ‘<code class=css>:first</code>’ or
simon@7435 1066 ‘<code class=css>:blank</code>’ pseudo-class, g=1; else g=0
fantasai@5967 1067
fantasai@5967 1068 <li>if the page selector has a ‘<code class=css>:left</code>’ or
fantasai@5967 1069 ‘<code class=css>:right</code>’ pseudo-class, h=1; else h=0
fantasai@114 1070 </ul>
fantasai@114 1071
simon@6795 1072 <p>Concatenating the three numbers f-g-h gives the specificity.
fantasai@213 1073
fantasai@213 1074 <div class=example>
simon@6795 1075 <p>Some page specificity calculation examples follow:
fantasai@213 1076
fantasai@213 1077 <pre>
fantasai@213 1078 @page { } /* f=0 g=0 h=0 -&gt; specificity = 000 */
fantasai@213 1079 @page :left { } /* f=0 g=0 h=1 -&gt; specificity = 001 */
fantasai@213 1080 @page :first { } /* f=0 g=1 h=0 -&gt; specificity = 010 */
fantasai@213 1081 @page artsy { } /* f=1 g=0 h=0 -&gt; specificity = 100 */
fantasai@213 1082 @page artsy:left { } /* f=1 g=0 h=1 -&gt; specificity = 101 */
simon@6957 1083 @page artsy:first { } /* f=1 g=1 h=0 -&gt; specificity = 110 */
fantasai@211 1084 </pre>
fantasai@114 1085 </div>
fantasai@114 1086
fantasai@213 1087 <div class=example>
simon@6795 1088 <p>Consider the following usage example:
fantasai@213 1089
fantasai@213 1090 <pre>
fantasai@213 1091 @page {
fantasai@213 1092 margin-left: 3cm;
fantasai@213 1093 }
fantasai@213 1094
fantasai@213 1095 @page :left {
fantasai@213 1096 margin-left: 4cm;
fantasai@213 1097 }
fantasai@211 1098 </pre>
fantasai@211 1099
fantasai@213 1100 <p>Due to the higher specificity of the pseudo-class selector, the left
fantasai@482 1101 margin on left pages will be 4cm and all other pages (the right-facing
simon@6795 1102 pages) will have a left margin of 3cm.
fantasai@114 1103 </div>
fantasai@114 1104
fantasai@213 1105 <div class=example>
fantasai@213 1106 <p>In this example, the higher specificity of the green rules wins over
fantasai@114 1107 the red rule. Therefore the first page will have blue text in the
simon@7289 1108 top-left page-margin box and green text in the top-right page-margin
simon@7289 1109 box, while subsequent pages will have red text in the page-margin boxes.
fantasai@114 1110
fantasai@213 1111 <pre>
fantasai@213 1112 @page :first {
fantasai@213 1113 color: green;
fantasai@213 1114
fantasai@213 1115 @top-left {
fantasai@213 1116 content: "foo";
fantasai@213 1117 color: blue;
fantasai@213 1118 }
fantasai@213 1119 @top-right {
fantasai@213 1120 content: "bar";
fantasai@213 1121 }
fantasai@213 1122 }
fantasai@213 1123
fantasai@213 1124 @page { color: red;
fantasai@213 1125 @top-center {
fantasai@213 1126 content: "Page " counter(page);
fantasai@213 1127 }
fantasai@213 1128 }
fantasai@114 1129 </pre>
fantasai@114 1130 </div>
fantasai@114 1131
fantasai@213 1132 <div class=example>
fantasai@213 1133 <p>Page contexts cascade, so the following stylesheet would style pages
simon@7289 1134 with 25 millimeter margins and 14 point type in the page-margin boxes:
fantasai@114 1135
fantasai@213 1136 <pre>
fantasai@213 1137 @page { margin: 25mm;}
fantasai@213 1138 @page { font-size: 14pt;}
fantasai@211 1139 </pre>
fantasai@114 1140 </div>
fantasai@114 1141
simon@7289 1142 <h2 id=margin-boxes><span class=secno>6. </span>Page-Margin Boxes</h2>
simon@7289 1143
simon@7289 1144 <p>Page-margin boxes are boxes within the page margin that, like
simon@6795 1145 pseudo-elements, can contain generated content.
fantasai@566 1146
simon@7289 1147 <p>Page-margin boxes can be used to create page headers and footers, which
simon@7289 1148 are portions of the page set aside for supplementary information such as
simon@7289 1149 the page number or document title.
fantasai@528 1150
fantasai@528 1151 <div class=example>
fantasai@566 1152 <p>Typically, a <dfn id=page-header>page header</dfn> is located at the
fantasai@566 1153 top of the page in documents with a predominately horizontal writing
fantasai@566 1154 direction and on the side opposite the <a href="#binding-edge">binding
fantasai@566 1155 edge</a> for documents with a predominately vertical writing direction.
fantasai@566 1156 One possible design of page headers for horizontally written documents
fantasai@5967 1157 uses the <span class=css>‘<code
fantasai@5967 1158 class=property>top-left-corner</code>’</span>, <span
fantasai@5967 1159 class=css>‘<code class=property>top-left</code>’</span>, <span
fantasai@5967 1160 class=css>‘<code class=property>top-center</code>’</span>, <span
fantasai@5967 1161 class=css>‘<code class=property>top-right</code>’</span> and <span
fantasai@5967 1162 class=css>‘<code class=property>top-right-corner</code>’</span>
simon@7289 1163 page-margin boxes. Another design, for vertically written documents,
simon@7289 1164 could use the <span class=css>‘<code
fantasai@5967 1165 class=property>right-top</code>’</span>, <span class=css>‘<code
fantasai@5967 1166 class=property>right-middle</code>’</span>, and <span
simon@7289 1167 class=css>‘<code class=property>right-bottom</code>’</span>
simon@7289 1168 page-margin boxes for <a href="#right-page">right facing pages</a> and
simon@7289 1169 <span class=css>‘<code class=property>left-top</code>’</span>, <span
fantasai@5967 1170 class=css>‘<code class=property>left-middle</code>’</span>, and
fantasai@5967 1171 <span class=css>‘<code class=property>left-bottom</code>’</span> for
simon@6795 1172 <a href="#left-page">left facing pages</a>.
fantasai@566 1173
fantasai@566 1174 <p>The <dfn id=page-footer>page footer</dfn> is typically at the opposite
fantasai@566 1175 end of the page from the page header. For example, the design of a
fantasai@566 1176 horizontally written document with a page header at the top of the page
fantasai@5967 1177 could use the <span class=css>‘<code
fantasai@5967 1178 class=property>bottom-left-corner</code>’</span>, <span
fantasai@5967 1179 class=css>‘<code class=property>bottom-left</code>’</span>, <span
fantasai@5967 1180 class=css>‘<code class=property>bottom-center</code>’</span>, <span
fantasai@5967 1181 class=css>‘<code class=property>bottom-right</code>’</span> and
fantasai@5967 1182 <span class=css>‘<code
simon@7289 1183 class=property>bottom-right-corner</code>’</span> page-margin boxes as
simon@7289 1184 the page footer. The design of a vertically written document could use
simon@7289 1185 the page-margin boxes of the binding edge of the page for the page
simon@7289 1186 footer.
fantasai@566 1187 </div>
fantasai@566 1188
simon@7289 1189 <p>Page-margin boxes are positioned with respect to the page area and are
simon@7289 1190 independent of page orientation, for example the top page-margin boxes
simon@7289 1191 are above the page area in both portrait and landscape orientation. The
simon@7289 1192 various page-margin boxes are defined and illustrated in the diagram
simon@7289 1193 below:
fantasai@566 1194
fantasai@3574 1195 <table class=data id=margin-box-def
simon@7289 1196 summary="defintion of each of the page-margin boxes">
simon@7289 1197 <caption>Table 1 Page-Margin Box Definitions</caption>
fantasai@566 1198
fantasai@566 1199 <thead>
fantasai@566 1200 <tr>
fantasai@566 1201 <th>Box
fantasai@566 1202
fantasai@566 1203 <th>Description
fantasai@566 1204
fantasai@566 1205 <th>Placement
fantasai@566 1206
fantasai@566 1207 <tbody>
fantasai@566 1208 <tr id=top-margin-boxes-def>
fantasai@566 1209 <th id=top-left-corner-box-def>top-left-corner
fantasai@566 1210
fantasai@566 1211 <td>a fixed-size box defined by the intersection of the top and left
fantasai@566 1212 margins of the page box
fantasai@566 1213
fantasai@3574 1214 <td><img
fantasai@3574 1215 alt="the top left corner box with margin, border, and padding, nested within intersection of the page's top and left margins"
fantasai@566 1216 height=47 src=TopLeftCornerBox.png width=181>
fantasai@566 1217
fantasai@566 1218 <tr id=top-left-box-def>
fantasai@566 1219 <th>top-left
fantasai@566 1220
fantasai@566 1221 <td>a variable-width box filling the top page margin between the
simon@7289 1222 top-left-corner and top-center page-margin boxes
fantasai@566 1223
fantasai@3574 1224 <td><img
fantasai@3574 1225 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@3574 1226 height=47 src=TopLeftMarginBox.png width=181>
fantasai@566 1227
fantasai@566 1228 <tr id=top-center-box-def>
fantasai@566 1229 <th>top-center
fantasai@566 1230
fantasai@566 1231 <td>a variable-width box centered horizontally between the page's left
fantasai@566 1232 and right border edges and filling the page top margin between the
simon@7289 1233 top-left and top-right page-margin boxes
fantasai@566 1234
fantasai@3574 1235 <td><img
fantasai@3574 1236 alt="the top center box with margin, border, and padding, centered within the page's top margin"
fantasai@3574 1237 height=47 src=TopCenterMarginBox.png width=181>
fantasai@566 1238
fantasai@566 1239 <tr id=top-right-box-def>
fantasai@566 1240 <th>top-right
fantasai@566 1241
fantasai@566 1242 <td>a variable-width box filling the top page margin between the
simon@7289 1243 top-center and top-right-corner page-margin boxes
fantasai@566 1244
fantasai@3574 1245 <td><img
fantasai@3574 1246 alt="the top right box with margin, border, and padding, nested within the page's top margin"
fantasai@3574 1247 height=47 src=TopRightMarginBox.png width=181>
fantasai@566 1248
fantasai@566 1249 <tr>
fantasai@566 1250 <th id=top-right-corner-box-def>top-right-corner
fantasai@566 1251
fantasai@566 1252 <td>a fixed-size box defined by the intersection of the top and right
fantasai@566 1253 margins of the page box
fantasai@566 1254
fantasai@3574 1255 <td><img
fantasai@3574 1256 alt="the top right corner box with margin, border, and padding, nested within the intersection of the page's top and right margin"
fantasai@3574 1257 height=47 src=TopRightCornerMarginBox.png width=181>
fantasai@566 1258
fantasai@566 1259 <tr id=left-margin-boxes-def>
fantasai@566 1260 <th id=left-top-box-def>left-top
fantasai@566 1261
fantasai@566 1262 <td>a variable-height box filling the left page margin between the
simon@7289 1263 top-left-corner and left-middle page-margin boxes
fantasai@566 1264
fantasai@3574 1265 <td rowspan=3><img
simon@7289 1266 alt="left-top, left-middle, and left-bottom page-margin boxes in the page box's left margin"
fantasai@3574 1267 height=226 src=LeftMarginBoxes.png width=181>
fantasai@566 1268
fantasai@566 1269 <tr id=left-middle-box-def>
fantasai@566 1270 <th>left-middle
fantasai@566 1271
fantasai@566 1272 <td>a variable-height box centered vertically between the page's top
fantasai@566 1273 and bottom border edges and filling the left page margin between the
simon@7289 1274 left-top and left-bottom page-margin boxes
fantasai@566 1275
fantasai@566 1276 <tr id=left-bottom-box-def>
fantasai@566 1277 <th>left-bottom
fantasai@566 1278
fantasai@566 1279 <td>a variable-height box filling the left page margin between the
simon@7289 1280 left-middle and bottom-left-corner page-margin boxes
fantasai@566 1281
fantasai@566 1282 <tr id=right-margin-boxes-def>
fantasai@566 1283 <th id=right-top-box-def>right-top
fantasai@566 1284
fantasai@566 1285 <td>a variable-height box filling the right page margin between the
simon@7289 1286 top-right-corner and right-middle page-margin boxes
fantasai@566 1287
fantasai@3574 1288 <td rowspan=3><img
simon@7289 1289 alt="right-top, right-middle, and right-bottom page-margin boxes in the page box's right margin"
fantasai@3574 1290 height=226 src=RightMarginBoxes.png width=181>
fantasai@566 1291
fantasai@566 1292 <tr id=right-middle-box-def>
fantasai@566 1293 <th>right-middle
fantasai@566 1294
fantasai@566 1295 <td>a variable-height box centered vertically between the page's top
fantasai@566 1296 and bottom border edges and filling the right page margin between the
simon@7289 1297 right-top and right-bottom page-margin boxes
fantasai@566 1298
fantasai@566 1299 <tr id=right-bottom-box-def>
fantasai@566 1300 <th>right-bottom
fantasai@566 1301
fantasai@566 1302 <td>a variable-height box filling the right page margin between the
simon@7289 1303 right-middle and bottom-right-corner page-margin boxes
fantasai@566 1304
fantasai@566 1305 <tr id=bottom-margin-boxes-def>
fantasai@566 1306 <th id=bottom-left-corner-box-def>bottom-left-corner
fantasai@566 1307
fantasai@566 1308 <td>a fixed-size box defined by the intersection of the bottom and left
fantasai@566 1309 margins of the page box
fantasai@566 1310
fantasai@3574 1311 <td><img
fantasai@3574 1312 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@3574 1313 height=48 src=BottomLeftCornerBox.png width=181>
fantasai@566 1314
fantasai@566 1315 <tr id=bottom-left-box-def>
fantasai@566 1316 <th>bottom-left
fantasai@566 1317
fantasai@566 1318 <td>a variable-width box filling the bottom page margin between the
simon@7289 1319 bottom-left-corner and bottom-center page-margin boxes
fantasai@566 1320
fantasai@3574 1321 <td><img
simon@7289 1322 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@3574 1323 height=48 src=BottomLeftMarginBox.png width=181>
fantasai@566 1324
fantasai@566 1325 <tr id=bottom-center-box-def>
fantasai@566 1326 <th>bottom-center
fantasai@566 1327
fantasai@566 1328 <td>a variable-width box centered horizontally between the page's left
fantasai@566 1329 and right border edges and filling the bottom page margin between the
simon@7289 1330 bottom-left and bottom-right page-margin boxes
fantasai@566 1331
fantasai@3574 1332 <td style="vertical-align: middle;"><img
fantasai@3574 1333 alt="bottom center box with margin, border, and padding, nested within the page's bottom margin and centered on the page"
fantasai@3574 1334 height=48 src=BottomCenterMarginBox.png width=181>
fantasai@566 1335
fantasai@566 1336 <tr id=bottom-right-box-def>
fantasai@566 1337 <th>bottom-right
fantasai@566 1338
fantasai@566 1339 <td>a variable-width box filling the bottom page margin between the
simon@7289 1340 bottom-center and bottom-right-corner page-margin boxes
fantasai@566 1341
fantasai@3574 1342 <td><img
simon@7289 1343 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@3574 1344 height=48 src=BottomRightMarginBox.png width=181>
fantasai@566 1345
fantasai@566 1346 <tr id=bottom-right-corner-box-def>
fantasai@566 1347 <th>bottom-right-corner
fantasai@566 1348
fantasai@566 1349 <td>a fixed-size box defined by the intersection of the bottom and
fantasai@566 1350 right margins of the page box
fantasai@566 1351
fantasai@3574 1352 <td><img
fantasai@3574 1353 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@3574 1354 height=48 src=BottomRightCornerBox.png width=181>
fantasai@566 1355 </table>
fantasai@566 1356
simon@7289 1357 <h3 id=margin-at-rules><span class=secno>6.1. </span>At-rules for
simon@7289 1358 page-margin boxes</h3>
simon@7289 1359
simon@7289 1360 <p>Page-margin boxes are created by <a href="#margin-at-rules">margin
fantasai@1738 1361 at-rules</a> inside the <a href="#page-context">page context</a>. These
fantasai@1738 1362 rules should come after any declarations in the page context as legacy
simon@6795 1363 clients may not handle declarations after margin at-rules correctly.
fantasai@566 1364
fantasai@566 1365 <p>A <dfn id=margin-at-rule>margin at-rule</dfn> consists of an <a
fantasai@566 1366 href="#specializatons-of-ATKEYWORD">ATKEYWORD</a> that identifies the
simon@7289 1367 page-margin box (e.g. <span class=css>‘<code
fantasai@5967 1368 class=css>@top-left</code>’</span>) and a block of declarations (said
simon@6795 1369 to be in the <dfn id=margin-context>margin context</dfn>).
fantasai@566 1370
fantasai@566 1371 <div class=example>
fantasai@566 1372 <p>The following style sheet establishes a page header containing the
fantasai@566 1373 title ("Hamlet") on the left side and the page number, preceded by "Page
simon@6795 1374 ", on the right side:
fantasai@566 1375
fantasai@528 1376 <pre>
fantasai@566 1377 @page {
fantasai@566 1378 size: 8.5in 11in;
fantasai@566 1379 margin: 10%;
fantasai@566 1380
fantasai@566 1381 @top-left {
fantasai@566 1382 content: "Hamlet";
fantasai@566 1383 }
fantasai@566 1384 @top-right {
fantasai@566 1385 content: "Page " counter(page);
fantasai@566 1386 }
fantasai@528 1387 }
fantasai@528 1388 </pre>
fantasai@528 1389 </div>
fantasai@528 1390
fantasai@1626 1391 <h3 id=populating-margin-boxes><span class=secno>6.2. </span>Populating
simon@7289 1392 page-margin boxes</h3>
fantasai@566 1393
fantasai@5969 1394 <p>As with the ‘<code class=css>:before</code>’ and ‘<code
fantasai@5969 1395 class=css>:after</code>’ pseudo-elements, a specified ‘<code
fantasai@5969 1396 class=property>content</code>’ of ‘<code class=css>normal</code>’
simon@7289 1397 on a page-margin box computes to ‘<code class=css>none</code>’, and
simon@7289 1398 the page-margin box is <dfn id=generated>generated</dfn> if and only if
simon@7289 1399 the computed value of its ‘<code class=property>content</code>’
simon@7289 1400 property is not ‘<code class=property>none</code>’. Otherwise it
simon@7289 1401 behaves as if it had ‘<code class=css>display: none</code>’.
fantasai@528 1402
fantasai@528 1403 <div class=example>
fantasai@566 1404 <p>The following style sheet creates a green box in each corner of the
simon@6795 1405 page except the bottom-left corner.
fantasai@566 1406
fantasai@528 1407 <pre>
fantasai@566 1408 @page {
fantasai@566 1409 @top-left-corner { content: " "; border: solid green; }
fantasai@1090 1410 @top-right-corner { content: url(foo.png); border: solid green; }
fantasai@1090 1411 @bottom-right-corner { content: counter(page); border: solid green; }
fantasai@566 1412 @bottom-left-corner { content: normal; border: solid green; }
fantasai@566 1413 }
fantasai@566 1414 </pre>
fantasai@566 1415 </div>
fantasai@566 1416
fantasai@1626 1417 <h3 id=margin-box-dimensions><span class=secno>6.3. </span>Computing
simon@7289 1418 Page-margin Box Dimensions</h3>
simon@7289 1419
simon@7289 1420 <p>The width and height of each page-margin box is determined by the rules
fantasai@1090 1421 below. These rules define the equivalent of CSS2.1 Sections 10.3 and 10.6
simon@7289 1422 for page-margin boxes.
fantasai@1090 1423
fantasai@5967 1424 <p>The rules for applying ‘<code class=property>min-height</code>’,
fantasai@5967 1425 ‘<code class=property>max-height</code>’, ‘<code
fantasai@5967 1426 class=property>min-width</code>’, and ‘<code
fantasai@5967 1427 class=property>max-width</code>’ <a href="#CSS21"
simon@7289 1428 rel=biblioentry>[CSS21]<!--{{!CSS21}}--></a> do apply to page-margin
simon@7289 1429 boxes and may imply a recalculation of the width, height, and/or margins
simon@7289 1430 if the dimensions resulting from the specified ‘<code
fantasai@5967 1431 class=property>width</code>’ or ‘<code
fantasai@5967 1432 class=property>height</code>’ violate their constraints. If the UA does
fantasai@5967 1433 not support the ‘<code class=property>min-height</code>’ or ‘<code
fantasai@5967 1434 class=property>min-width</code>’ properties then it must behave as if
fantasai@5967 1435 ‘<code class=property>min-height</code>’ and ‘<code
fantasai@5967 1436 class=property>min-width</code>’ were always zero.
fantasai@566 1437
simon@7289 1438 <h4 id=max-margin-dimension><span class=secno>6.3.1. </span>Page-Margin
simon@7289 1439 Box Layout Terminology</h4>
fantasai@566 1440
fantasai@566 1441 <p>In addition to the box model definitions in CSS2.1 <a href="#CSS21"
fantasai@566 1442 rel=biblioentry>[CSS21]<!--{{!CSS21}}--></a>, the following terms are
simon@7289 1443 defined for use in the subsequent page-margin box calculations:
fantasai@566 1444
fantasai@566 1445 <dl>
simon@6958 1446 <dt id=MaxBoxWidth><dfn id=max-box-width>max box width</dfn>
simon@6958 1447
simon@6958 1448 <dd>the sum of the page’s left border width, left padding, <a
fantasai@566 1449 href="#page-box">page area</a> width, right padding, and right border
fantasai@566 1450 width. In other words, it is the distance between the <a
simon@6958 1451 href="#page-box">page box</a>’s left border edge and right border
simon@6958 1452 edge. This quantity is used when calculating dimensions of the top and
simon@7289 1453 bottom page-margin boxes.
simon@6958 1454
simon@6958 1455 <dt id=MaxBoxHeight><dfn id=max-box-height>max box height</dfn>
fantasai@566 1456
fantasai@5967 1457 <dd>the sum of the page’s top border width, top padding, <a
fantasai@566 1458 href="#page-box">page area</a> height, bottom padding, and bottom border
fantasai@566 1459 width. In other words, it is the distance between the <a
simon@6958 1460 href="#page-box">page box</a>’s top border edge and bottom border
simon@6958 1461 edge. This quantity is used when calculating dimensions of the left and
simon@7289 1462 right page-margin boxes.
simon@6958 1463
simon@6958 1464 <dt><dfn id=outer-width>outer width</dfn>
simon@6958 1465
simon@7289 1466 <dd>the sum of a page-margin box's left and right margins, left and right
fantasai@5967 1467 border widths, left and right padding, and content-box width.
fantasai@566 1468
simon@6958 1469 <dt><dfn id=outer-height>outer height</dfn>
fantasai@566 1470
simon@7289 1471 <dd>the sum of a page-margin box's top and bottom margins, top and bottom
fantasai@1626 1472 border widths, top and bottom padding, and content-box height.
fantasai@566 1473 </dl>
fantasai@566 1474
simon@6957 1475 <dl>
simon@6958 1476 <dt><dfn id=outer-min-content>outer min-content</dfn> width
simon@6958 1477
simon@6958 1478 <dd>Like the <a href="#outer-width"><i>outer width</i></a>, except that
simon@6958 1479 <a href="http://www.w3.org/TR/css3-sizing/#min-content">‘<code
simon@6958 1480 class=css>min-content</code>’</a> is used when ‘<code
simon@6958 1481 class=property>width</code>’ is ‘<code class=css>auto</code>’.
simon@6958 1482
simon@6958 1483 <dt><dfn id=outer-max-content>outer max-content</dfn> width
simon@6958 1484
simon@6958 1485 <dd>Like the <a href="#outer-width"><i>outer width</i></a>, except that
simon@6958 1486 <a href="http://www.w3.org/TR/css3-sizing/#max-content">‘<code
simon@6958 1487 class=css>max-content</code>’</a> is used when ‘<code
simon@6958 1488 class=property>width</code>’ is ‘<code class=css>auto</code>’.
simon@6957 1489 </dl>
simon@6957 1490
simon@7289 1491 <p>The <dfn id=containing-block>containing block</dfn> for a corner
simon@7289 1492 page-margin box is the rectangle defined by the intersection of the two
simon@7289 1493 page margins meeting at that corner.
simon@7289 1494
simon@7289 1495 <p>For all other page-margin boxes, the <dfn
simon@7289 1496 id=containing-block0>containing block</dfn> is the rectangle formed by
simon@7289 1497 the encapsulating page margin minus the containing blocks of the adjacent
simon@7289 1498 corners' page-margin boxes. This means that the size of this containing
simon@7289 1499 block is given in one dimension by the used page margin and in the other
simon@7289 1500 dimension by the <a href="#MaxBoxWidth">max box width</a> (for top and
simon@7289 1501 bottom page-margin boxes) or <a href="#MaxBoxHeight">max box height</a>
simon@7289 1502 (for left and right page-margin boxes).
simon@7289 1503
simon@7289 1504 <h4 id=margin-dimension><span class=secno>6.3.2. </span>Page-Margin Box
fantasai@1626 1505 Variable Dimension Computation Rules</h4>
fantasai@566 1506
fantasai@5967 1507 <p>The following rules apply to ‘<code
fantasai@5967 1508 class=property>top-left</code>’, ‘<code
fantasai@5967 1509 class=property>top-center</code>’ and ‘<code
simon@7289 1510 class=property>top-right</code>’ page-margin boxes, which are referred
simon@7289 1511 to as A, B, and C, respectively, in this section.
simon@6957 1512
simon@7053 1513 <h5 id=marginbox-variabledim-margins><span class=secno>6.3.2.1.
simon@7053 1514 </span>Margins</h5>
simon@7053 1515
simon@6957 1516 <p>If the ‘<code class=property>margin-left</code>’ or ‘<code
simon@6957 1517 class=property>margin-right</code>’ property of any of the three boxes
simon@6957 1518 computes to ‘<code class=css>auto</code>’, the used value is zero.
simon@6957 1519
simon@7053 1520 <h5 id=marginbox-variabledim-with><span class=secno>6.3.2.2.
simon@7053 1521 </span>Resolving ‘<code class=css>auto</code>’ widths</h5>
simon@6957 1522
simon@6957 1523 <p>The following algorithm determines the used width of each box. For this
simon@7055 1524 purpose, boxes that are not <a href="#generated"><i>generated</i></a> are
simon@7055 1525 assumed to have a ‘<code class=property>width</code>’ and an <a
simon@7052 1526 href="#outer-width"><i>outer width</i></a> of zero.
simon@6957 1527
simon@6958 1528 <p class=note> Note: The high-level goals are (in order of priority) to
simon@6957 1529 center the middle box (B) if it is generated, to minimize overflow and
simon@6957 1530 overlap, and to distribute space proportionally to the amount of content.
simon@6957 1531
simon@7052 1532 <ol>
simon@7052 1533 <li> If B is not <a href="#generated"><i>generated</i></a>:
simon@7052 1534 <ol>
simon@7052 1535 <li> If only box has ‘<code class=css>width: auto</code>’, its used
simon@7052 1536 width is resolved so that the sum of the <a
simon@7052 1537 href="#outer-width"><i>outer width</i></a>s equals <a
simon@7052 1538 href="#max-box-width"><i>max box width</i></a>.
simon@7052 1539
simon@7052 1540 <li> If A and C both have ‘<code class=css>width: auto</code>’:
simon@7052 1541 <ol>
simon@7052 1542 <li> Let <i>free space</i> be <a href="#max-box-width"><i>max box
simon@7052 1543 width</i></a> minus A’s and C’s <i>outer min-content width</i>.
simon@7052 1544
simon@7052 1545 <li> If <i>free space</i> is positive, let the respective
simon@7052 1546 <i>weight</i> for A and C be <i>max-content</i> minus
simon@7052 1547 <i>min-content</i>. If it is negative or zero, let the weights be
simon@7052 1548 <i>min-content</i>. In either case if both weights are zero, let
simon@7052 1549 them be ‘<code class=css>1px</code>’ instead. <span class=note>
simon@7052 1550 The ‘<code class=css>1px</code>’ value is arbitrary as long as
simon@7052 1551 the weights are equal. </span>
simon@7052 1552
simon@7052 1553 <li> The respective used width is <i>min-content</i> + <i>free
simon@7052 1554 space</i> × <i>weight</i> ÷ sum of both weights
simon@7052 1555 </ol>
simon@7052 1556 </ol>
simon@7052 1557
simon@7052 1558 <li> If B is <a href="#generated"><i>generated</i></a>:
simon@7052 1559 <ol>
simon@7052 1560 <li> If B has ‘<code class=css>width: auto</code>’:
simon@7052 1561 <ol>
simon@7052 1562 <li> Let <i>free space</i> be <a href="#max-box-width"><i>max box
simon@7052 1563 width</i></a> - 2 × max(<i>min<sub>A</sub></i>,
simon@7052 1564 <i>min<sub>C</sub></i>) - <i>min<sub>B</sub></i>, where <i>min</i>
simon@7052 1565 is a box’s <i>outer min-content width</i> if ‘<code
simon@7052 1566 class=property>width</code>’ is ‘<code class=css>auto</code>’,
simon@7052 1567 zero otherwise.
simon@7052 1568
simon@7052 1569 <li> Let <i>upper limit</i> be <a href="#max-box-width"><i>max box
simon@7052 1570 width</i></a> - 2 × max(<i>fixed<sub>A</sub></i>,
simon@7052 1571 <i>fixed<sub>C</sub></i>), where <i>fixed</i> is a box’s <a
simon@7052 1572 href="#outer-width"><i>outer width</i></a> if ‘<code
simon@7052 1573 class=property>width</code>’ is not ‘<code
simon@7052 1574 class=css>auto</code>’, zero otherwise.
simon@7052 1575
simon@7052 1576 <li> If <i>free space</i> is positive, let the <i>weight</i> of a box
simon@7052 1577 be <i>max-content</i> minus <i>min-content</i>. If it is negative or
simon@7052 1578 zero, let the weights be <i>min-content</i>.
simon@7052 1579
simon@7052 1580 <li> Let <i>weight<sub>AC</sub></i> be max(<i>weight<sub>A</sub></i>,
simon@7052 1581 <i>weight<sub>C</sub></i>)
simon@7052 1582
simon@7052 1583 <li> If both <i>weight<sub>AC</sub></i> and <i>weight<sub>B</sub></i>
simon@7052 1584 are zero, let them be ‘<code class=css>1px</code>’ instead.
simon@7052 1585
simon@7052 1586 <li> B’s used width is min(<i>upper limit</i>, <i>min-content</i> +
simon@7052 1587 <i>free space</i> × <i>weight<sub>B</sub></i> ÷
simon@7052 1588 (<i>weight<sub>AC</sub></i> + <i>weight<sub>B</sub></i>))
simon@7052 1589 </ol>
simon@7052 1590
simon@7052 1591 <li> Then, if A or C has ‘<code class=css>width: auto</code>’, the
simon@7052 1592 respective used widths are resolved so that <a
simon@7052 1593 href="#outer-width"><i>outer width</i></a> equals (<a
simon@7052 1594 href="#max-box-width"><i>max box width</i></a> - B’s <a
simon@7052 1595 href="#outer-width"><i>outer width</i></a>) ÷ 2
simon@7052 1596 </ol>
simon@7052 1597 </ol>
fantasai@566 1598
simon@7054 1599 <h5 id=marginbox-variabledim-minmax><span class=secno>6.3.2.3.
simon@7054 1600 </span>Handling ‘<code class=property>min-width</code>’ and ‘<code
simon@7054 1601 class=property>max-width</code>’</h5>
simon@7054 1602
simon@7054 1603 <p> The ‘<code class=property>min-width</code>’ and ‘<code
simon@7054 1604 class=property>max-width</code>’ properties <a href="#CSS21"
simon@7054 1605 rel=biblioentry>[CSS21]<!--{{CSS21}}--></a> apply to page-margin boxes in
simon@7054 1606 the variable dimension like on normal elements, except that the three
simon@7054 1607 boxes on the same side are considered together.
simon@7054 1608
simon@7054 1609 <p> More precisely:
simon@7054 1610
simon@7054 1611 <ol>
simon@7054 1612 <li> The tentative used widths are calculated (without ‘<code
simon@7054 1613 class=property>min-width</code>’ and ‘<code
simon@7054 1614 class=property>max-width</code>’) following the rules under <a
simon@7054 1615 href="#marginbox-variabledim-with">Resolving ‘<code
simon@7054 1616 class=css>auto</code>’ widths</a> above.
simon@7054 1617
simon@7054 1618 <li> If the tentative used width of any of the three boxes is greater
simon@7054 1619 than ‘<code class=property>max-width</code>’, the rules above are
simon@7054 1620 applied again, but this time using the computed value of ‘<code
simon@7054 1621 class=property>max-width</code>’ as the computed value for ‘<code
simon@7054 1622 class=property>width</code>’.
simon@7054 1623
simon@7054 1624 <li> If the resulting width of any of the three boxes is smaller than
simon@7054 1625 ‘<code class=property>min-width</code>’, the rules above are applied
simon@7054 1626 again, but this time using the value of ‘<code
simon@7054 1627 class=property>min-width</code>’ as the computed value for ‘<code
simon@7054 1628 class=property>width</code>’.
simon@7054 1629 </ol>
simon@7054 1630
simon@7054 1631 <h5 id=marginbox-variabledim-positioning><span class=secno>6.3.2.4.
simon@7053 1632 </span>Positioning</h5>
simon@7053 1633
simon@7053 1634 <p> Once the dimensions of the boxes are determined, they are positioned
simon@7053 1635 as follows:
simon@7053 1636
simon@7053 1637 <ul>
simon@7053 1638 <li>The left outer edge of A is flush with the left edge of the
simon@7053 1639 containing block
simon@7053 1640
simon@7053 1641 <li>The outer area of B is centered in the containing block.
simon@7053 1642
simon@7053 1643 <li>The right outer edge of C is flush with the right edge of the
simon@7053 1644 containing block.
simon@7053 1645 </ul>
simon@7053 1646
simon@7054 1647 <h5 id=marginbox-variabledim-others><span class=secno>6.3.2.5.
simon@7053 1648 </span>Boxes on other sides</h5>
simon@7053 1649
fantasai@5967 1650 <p>The used values for ‘<code class=property>bottom-left</code>’,
fantasai@5967 1651 ‘<code class=property>bottom-center</code>’ and ‘<code
simon@7289 1652 class=property>bottom-right</code>’ page-margin boxes are established
simon@7289 1653 by the same rules as for ‘<code class=property>top-left</code>’,
simon@7289 1654 ‘<code class=property>top-center</code>’, and ‘<code
simon@6795 1655 class=property>top-right</code>’, respectively.
fantasai@5967 1656
fantasai@5967 1657 <p>The used values for ‘<code class=property>left-top</code>’,
fantasai@5967 1658 ‘<code class=property>left-middle</code>’ and ‘<code
fantasai@5967 1659 class=property>left-bottom</code>’ boxes are established by the same
fantasai@5967 1660 rules, with "width" replaced by "height", "left" by "top", "right" by
simon@6795 1661 "bottom" and "center" by "middle".
fantasai@5967 1662
fantasai@5967 1663 <p>The used values for ‘<code class=property>right-top</code>’,
fantasai@5967 1664 ‘<code class=property>right-middle</code>’ and ‘<code
simon@7289 1665 class=property>right-bottom</code>’ page-margin boxes are established
simon@7289 1666 by the same rules as for ‘<code class=property>left-top</code>’,
simon@7289 1667 ‘<code class=property>left-middle</code>’ and ‘<code
simon@6795 1668 class=property>left-bottom</code>’, respectively.
fantasai@566 1669
simon@7289 1670 <h4 id=margin-constraints><span class=secno>6.3.3. </span>Page-Margin Box
simon@7289 1671 Fixed Dimension Computation Rules</h4>
fantasai@566 1672
fantasai@5967 1673 <p>The rules below are used to calculate the used values of each ‘<code
fantasai@5967 1674 class=property>top-left-corner</code>’, ‘<code
fantasai@5967 1675 class=property>top-left</code>’, ‘<code
fantasai@5967 1676 class=property>top-center</code>’, ‘<code
fantasai@5967 1677 class=property>top-right</code>’, and ‘<code
simon@7289 1678 class=property>top-right-corner</code>’ page-margin box's ‘<code
fantasai@5967 1679 class=property>height</code>’, ‘<code
fantasai@5967 1680 class=property>margin-top</code>’, and ‘<code
simon@6795 1681 class=property>margin-bottom</code>’ properties:
fantasai@1090 1682
fantasai@1090 1683 <ol>
fantasai@1090 1684 <li>The following constraint must hold among the used values of the
fantasai@1090 1685 margin box's properties:
fantasai@5967 1686 <p>‘<code class=property>margin-top</code>’ + ‘<code
fantasai@5967 1687 class=property>border-top-width</code>’ + ‘<code
fantasai@5967 1688 class=property>padding-top</code>’ + ‘<code
fantasai@5967 1689 class=property>height</code>’ + ‘<code
fantasai@5967 1690 class=property>padding-bottom</code>’ + ‘<code
fantasai@5967 1691 class=property>border-bottom-width</code>’ + ‘<code
fantasai@5967 1692 class=property>margin-bottom</code>’ = top page margin
fantasai@5967 1693
fantasai@5967 1694 <li>If ‘<code class=property>border-top-width</code>’ + ‘<code
fantasai@5967 1695 class=property>padding-top</code>’ + ‘<code
fantasai@5967 1696 class=property>height</code>’ (if it is not ‘<code
fantasai@5967 1697 class=css>auto</code>’) + ‘<code
fantasai@5967 1698 class=property>padding-bottom</code>’ + ‘<code
fantasai@5967 1699 class=property>border-bottom-width</code>’, plus ‘<code
fantasai@5967 1700 class=property>margin-top</code>’ and/or ‘<code
fantasai@5967 1701 class=property>margin-bottom</code>’ if not ‘<code
fantasai@5967 1702 class=css>auto</code>’, is larger than the height of the top page
fantasai@5967 1703 margin, then any ‘<code class=css>auto</code>’ values for ‘<code
fantasai@5967 1704 class=property>margin-top</code>’ or ‘<code
fantasai@5967 1705 class=property>margin-bottom</code>’ are, for the following rules,
fantasai@1090 1706 treated as zero.
fantasai@1090 1707
fantasai@5967 1708 <li>If at this point all of ‘<code class=property>height</code>’,
fantasai@5967 1709 ‘<code class=property>margin-top</code>’, and ‘<code
fantasai@5967 1710 class=property>margin-bottom</code>’ have a computed value other than
fantasai@5967 1711 ‘<code class=css>auto</code>’, the values are said to be
fantasai@5967 1712 "over-constrained". In this case, the specified value of ‘<code
fantasai@5967 1713 class=property>margin-top</code>’ is treated as ‘<code
fantasai@5967 1714 class=property>auto</code>’.
fantasai@5967 1715
fantasai@5967 1716 <li>If there is now exactly one value specified as ‘<code
fantasai@5967 1717 class=property>auto</code>’, its used value follows from the equality.
fantasai@5967 1718
fantasai@5967 1719 <li>If ‘<code class=property>height</code>’ is set to ‘<code
fantasai@5967 1720 class=property>auto</code>’, any other ‘<code
fantasai@5967 1721 class=property>auto</code>’ values become ‘<code
fantasai@5967 1722 class=css>0</code>’ and ‘<code class=property>height</code>’
fantasai@5967 1723 follows from the resulting equality
fantasai@5967 1724
fantasai@5967 1725 <li>If both ‘<code class=property>margin-top</code>’ and ‘<code
fantasai@5967 1726 class=property>margin-bottom</code>’ are ‘<code
fantasai@5967 1727 class=property>auto</code>’, their used values are equal. This
simon@7289 1728 vertically centers the page-margin box content within the top page
simon@7289 1729 margin.
fantasai@1090 1730 </ol>
fantasai@566 1731
simon@7289 1732 <p>The same rules apply to the bottom page-margin boxes
simon@7289 1733 (bottom-left-corner, bottom-left, bottom-center, bottom-right, and
simon@7289 1734 bottom-right-corner), except that in the overconstrained case, the
simon@7289 1735 ‘<code class=property>margin-bottom</code>’ is ignored rather than
simon@7289 1736 the ‘<code class=property>margin-top</code>’.
simon@7289 1737
simon@7289 1738 <p>Analogous rules govern the properties for the left and right
simon@7289 1739 page-margin boxes with respect to ‘<code class=property>width</code>’
fantasai@566 1740 (top-left-corner, left-top, left-middle, left-bottom, and
fantasai@566 1741 bottom-left-corner; top-right-corner, right-top, right-middle,
fantasai@5967 1742 right-bottom, bottom-right-corner), with ‘<code
fantasai@5967 1743 class=property>top</code>’ replaced by ‘<code
fantasai@5967 1744 class=property>left</code>’, ‘<code class=property>bottom</code>’
fantasai@5967 1745 replaced by ‘<code class=property>right</code>’, and ‘<code
fantasai@5967 1746 class=property>height</code>’ replaced by ‘<code
fantasai@5967 1747 class=property>width</code>’. In the overconstrained case for left
simon@7289 1748 (right) page-margin boxes, the specified value of ‘<code
fantasai@5967 1749 class=property>margin-left</code>’ (‘<code
simon@6795 1750 class=property>margin-right</code>’) is ignored.
fantasai@566 1751
simon@7289 1752 <h3 id=margin-box-ex><span class=secno>6.4. </span>Page-margin box
simon@7289 1753 examples</h3>
simon@7289 1754
simon@7289 1755 <p>The following is a collection of examples of page-margin box usage.
fantasai@566 1756
fantasai@566 1757 <div class=example>
simon@6795 1758 <p>Here is an example of a page with only a top-left header:
fantasai@566 1759
fantasai@566 1760 <pre>
fantasai@566 1761 @page {
fantasai@566 1762 @top-left { content: "Header in Left Cell (top-left)" }
fantasai@528 1763 }
fantasai@528 1764 </pre>
fantasai@566 1765
fantasai@566 1766 <p>Because there are no contents defined for the top-center or the
simon@7289 1767 top-right page-margin boxes, the extent of the top-left page-margin box
simon@7289 1768 is allowed to cross the center of the page box.
simon@6795 1769
simon@6795 1770 <p><img alt="Header Example 1" height=177 src=header-ex-1.png width=737>
fantasai@528 1771 </div>
fantasai@528 1772
fantasai@528 1773 <div class=example>
simon@6795 1774 <p>The following is an example of a page with a centered header:
fantasai@566 1775
fantasai@528 1776 <pre>
fantasai@566 1777 @page {
fantasai@566 1778 @top-center { content: "Header in Center Cell (top-center)" }
fantasai@566 1779 }
fantasai@528 1780 </pre>
fantasai@528 1781
simon@6795 1782 <p><img alt="Header Example 2" height=177 src=header-ex-2.png width=737>
fantasai@528 1783 </div>
fantasai@528 1784
fantasai@566 1785 <div class=example>
fantasai@566 1786 <p>The following is an example of a page with a single header in the
simon@7289 1787 top-right page-margin box:
fantasai@566 1788
fantasai@566 1789 <pre>
fantasai@566 1790 @page {
fantasai@566 1791 @top-right { content: "Header in Right Cell (top-right)" }
fantasai@566 1792 }
fantasai@566 1793 </pre>
fantasai@566 1794
fantasai@566 1795 <p>Because the content of the center cell is empty, the extent of the
simon@7289 1796 top-right page-margin box is allowed to cross the center of the page
simon@7289 1797 box.
simon@6795 1798
simon@6795 1799 <p><img alt="Header Example 3" height=177 src=header-ex-3.png width=737>
fantasai@528 1800 </div>
fantasai@528 1801
fantasai@566 1802 <div class=example>
fantasai@566 1803 <p>The following is an example of a page with a top-center and a top-left
simon@6795 1804 header:
fantasai@566 1805
fantasai@566 1806 <pre>
fantasai@566 1807 @page {
fantasai@566 1808 @top-left { content: "Left Cell (top-left)" }
fantasai@566 1809 @top-center { content: "Header in Center Cell (top-center)" }
fantasai@566 1810 }
fantasai@566 1811 </pre>
fantasai@566 1812
simon@6795 1813 <p><img alt="Header Example 4" height=177 src=header-ex-4.png width=737>
fantasai@528 1814 </div>
fantasai@528 1815
fantasai@566 1816 <div class=example>
fantasai@566 1817 <p>The following is an example of a page with a top-center and a
simon@6795 1818 top-right header:
fantasai@566 1819
fantasai@566 1820 <pre>
fantasai@566 1821 @page {
fantasai@566 1822 @top-center { content: "Header in Center Cell (top-center)" }
fantasai@566 1823 @top-right { content: "Right Cell (top-right)" }
fantasai@566 1824 }
fantasai@566 1825 </pre>
fantasai@566 1826
simon@6795 1827 <p><img alt="Header Example 5" height=177 src=header-ex-5.png width=737>
fantasai@566 1828 </div>
fantasai@566 1829
fantasai@566 1830 <div class=example>
fantasai@566 1831 <p>The following is an example of a page with top-left and top-right
simon@6795 1832 headers:
fantasai@566 1833
fantasai@566 1834 <pre>
fantasai@566 1835 @page {
fantasai@566 1836 @top-left { content: "Header in top-left with approx. "
fantasai@566 1837 "twice as many words as right cell." }
fantasai@566 1838 @top-right { content: "Right cell (top-right)" }
fantasai@566 1839 }
fantasai@566 1840 </pre>
fantasai@566 1841
fantasai@566 1842 <p>Because there are no center cell contents, the extent of the top-left
simon@6795 1843 is allowed to cross the center of the page box.
simon@6795 1844
simon@6795 1845 <p><img alt="Header Example 6" height=177 src=header-ex-6.png width=737>
fantasai@566 1846 </div>
fantasai@566 1847
fantasai@1626 1848 <h2 id=page-properties><span class=secno>7. </span>Page Properties</h2>
fantasai@114 1849
fantasai@114 1850 <div>
fantasai@3574 1851 <p>The following properties, when used in the <a
simon@6795 1852 href="#page-context">page context</a>, apply to the page box:
fantasai@114 1853
fantasai@114 1854 <ul>
fantasai@5976 1855 <li><a
fantasai@5976 1856 href="http://www.w3.org/TR/CSS21/colors.html#background-properties">background
fantasai@213 1857 properties</a>
fantasai@213 1858
fantasai@5976 1859 <li><a
fantasai@5976 1860 href="http://www.w3.org/TR/CSS21/box.html#border-properties">border
fantasai@213 1861 properties</a>
fantasai@213 1862
fantasai@5976 1863 <li><a
fantasai@5976 1864 href="http://www.w3.org/TR/CSS21/colors.html#propdef-color">color</a>
fantasai@5976 1865
fantasai@5976 1866 <li><a href="http://www.w3.org/TR/CSS21/generate.html#counters">counter
fantasai@5976 1867 properties</a>
fantasai@5976 1868
fantasai@5976 1869 <li><a
fantasai@5976 1870 href="http://www.w3.org/TR/CSS21/visuren.html#direction">direction</a>
fantasai@5976 1871
fantasai@5976 1872 <li><a href="http://www.w3.org/TR/CSS21/fonts.html">font properties</a>
fantasai@5976 1873
fantasai@5976 1874 <li><a
fantasai@5976 1875 href="http://www.w3.org/TR/CSS21/visudet.html#line-height">line-height</a>
fantasai@5976 1876
fantasai@5976 1877 <li><a
fantasai@5976 1878 href="http://www.w3.org/TR/CSS21/box.html#margin-properties">margin
fantasai@5976 1879 properties</a>
fantasai@5976 1880
fantasai@5976 1881 <li><a
fantasai@5976 1882 href="http://www.w3.org/TR/CSS21/ui.html#dynamic-outlines">outline
fantasai@5976 1883 properties</a>
fantasai@5976 1884
fantasai@5976 1885 <li><a
fantasai@5976 1886 href="http://www.w3.org/TR/CSS21/box.html#padding-properties">padding
fantasai@5976 1887 properties</a>
fantasai@5976 1888
fantasai@5976 1889 <li><a
fantasai@5976 1890 href="http://www.w3.org/TR/CSS21/generate.html#quotes-specify">quotes</a>
fantasai@563 1891
fantasai@213 1892 <li><a href="#page-size">size</a>
fantasai@213 1893
fantasai@5976 1894 <li><a href="http://www.w3.org/TR/CSS21/text.html">text properties</a>
fantasai@5976 1895
fantasai@5976 1896 <li><a
fantasai@5976 1897 href="http://www.w3.org/TR/CSS21/visufx.html#visibility">visibility</a>
fantasai@114 1898 </ul>
fantasai@114 1899
fantasai@3574 1900 <p>The following properties, when used in a <a
simon@7289 1901 href="#margin-at-rule">margin context</a>, apply to page-margin boxes
simon@7289 1902 and their content:
fantasai@114 1903
fantasai@114 1904 <ul>
fantasai@5976 1905 <li><a
fantasai@5976 1906 href="http://www.w3.org/TR/CSS21/colors.html#background-properties">background
fantasai@561 1907 properties</a>
fantasai@561 1908
fantasai@5976 1909 <li><a
fantasai@5976 1910 href="http://www.w3.org/TR/CSS21/box.html#border-properties">border
fantasai@5976 1911 properties</a>
fantasai@5976 1912
fantasai@5976 1913 <li><a
fantasai@5976 1914 href="http://www.w3.org/TR/CSS21/colors.html#propdef-color">color</a>
fantasai@5976 1915
fantasai@5976 1916 <li><a
fantasai@5976 1917 href="http://www.w3.org/TR/CSS21/generate.html#content">content</a>
fantasai@5976 1918
fantasai@5976 1919 <li><a href="http://www.w3.org/TR/CSS21/generate.html#counters">counter
fantasai@5976 1920 properties</a>
fantasai@5976 1921
fantasai@5976 1922 <li><a href="http://www.w3.org/TR/CSS21/fonts.html">font properties</a>
fantasai@5976 1923
fantasai@5976 1924 <li><a
fantasai@5976 1925 href="http://www.w3.org/TR/CSS21/visudet.html#the-height-property">height</a>
fantasai@5976 1926 <a
fantasai@5976 1927 href="http://www.w3.org/TR/CSS21/visudet.html#min-max-heights">properties</a>
fantasai@561 1928
fantasai@5976 1929 <li><a
fantasai@5976 1930 href="http://www.w3.org/TR/CSS21/visudet.html#line-height">line-height</a>
fantasai@213 1931
fantasai@5976 1932 <li><a
fantasai@5976 1933 href="http://www.w3.org/TR/CSS21/box.html#margin-properties">margin
fantasai@561 1934 properties</a>
fantasai@561 1935
fantasai@5976 1936 <li><a
fantasai@5976 1937 href="http://www.w3.org/TR/CSS21/ui.html#dynamic-outlines">outline
fantasai@5976 1938 properties</a>
fantasai@5976 1939
fantasai@5976 1940 <li><a
fantasai@5976 1941 href="http://www.w3.org/TR/CSS21/visufx.html#overflow">overflow</a>
fantasai@5976 1942
fantasai@5976 1943 <li><a
fantasai@5976 1944 href="http://www.w3.org/TR/CSS21/box.html#padding-properties">padding
fantasai@5976 1945 properties</a>
fantasai@5976 1946
fantasai@5976 1947 <li><a
fantasai@5976 1948 href="http://www.w3.org/TR/CSS21/generate.html#quotes-specify">quotes</a>
fantasai@5976 1949
fantasai@5976 1950 <li><a href="http://www.w3.org/TR/CSS21/text.html">text properties</a>
fantasai@5976 1951
fantasai@5976 1952 <li><a
fantasai@5976 1953 href="http://www.w3.org/TR/CSS21/visudet.html#line-height">vertical-align</a>
fantasai@5976 1954
fantasai@5976 1955 <li><a
fantasai@5976 1956 href="http://www.w3.org/TR/CSS21/visufx.html#visibility">visibility</a>
fantasai@5976 1957
fantasai@5976 1958 <li><a
fantasai@5976 1959 href="http://www.w3.org/TR/CSS21/visudet.html#the-width-property">width</a>
fantasai@5976 1960 <a
fantasai@5976 1961 href="http://www.w3.org/TR/CSS21/visudet.html#min-max-widths">properties</a>
fantasai@5976 1962
fantasai@5976 1963 <li><a
fantasai@5976 1964 href="http://www.w3.org/TR/CSS21/visuren.html#z-index">z-index</a>
fantasai@114 1965 </ul>
fantasai@114 1966
fantasai@213 1967 <p>A detailed list of properties that <em class=RFC2119>MUST</em> be
fantasai@114 1968 supported within page and margin contexts by a conforming implementation
simon@6795 1969 can be found in <a href="#properties-list">Appendix A</a>.
fantasai@114 1970
fantasai@213 1971 <p>Other properties defined by <a href="#CSS21"
fantasai@557 1972 rel=biblioentry>[CSS21]<!--{{!CSS21}}--></a> do not apply in these
annevk@150 1973 contexts. Behavior for properties not included in CSS 2.1 and not listed
simon@6795 1974 here or in Appendix A is undefined.
annevk@150 1975
fantasai@213 1976 <p class=note> Note: The intent of leaving other properties undefined is
fantasai@213 1977 to allow the gradual addition of appropriate CSS3 properties as they
simon@6795 1978 emerge, without having to update this specification with each addition.
fantasai@114 1979
fantasai@1133 1980 <p><a href="http://www.w3.org/TR/CSS21/cascade.html#value-stages">As with
fantasai@1133 1981 elements in the document</a>, both the page context and the margin
fantasai@1133 1982 context have a computed value for every property, even if that property
simon@7289 1983 does not apply to the page or page-margin box.
fantasai@1133 1984
fantasai@566 1985 <p>The normal rules for CSS properties apply with the following
simon@6795 1986 exceptions:
fantasai@114 1987
fantasai@114 1988 <ul>
simon@7289 1989 <li>page-margin boxes inherit from the page context. The page context
fantasai@1090 1990 inherits from the root element. However, since the previous revision of
fantasai@1090 1991 CSS Paged Media Level 3 did not specify this point, an implementation
fantasai@1090 1992 that sets inherited properties in the page context to their initial
fantasai@1090 1993 values (as for the root element) is also conformant to CSS Paged Media
fantasai@1090 1994 Level 3. Note that this exception will be removed in Level 4.
fantasai@1090 1995
fantasai@5967 1996 <li>Values in units of ‘<code class=css>em</code>’ and ‘<code
fantasai@5967 1997 class=css>ex</code>’ are interpreted relative to the font associated
fantasai@5967 1998 with their context. When used on the ‘<code
fantasai@5967 1999 class=property>font-size</code>’ property in the margin context, they
fantasai@5967 2000 are relative to the font of the page context. When used on the ‘<code
fantasai@5967 2001 class=property>font-size</code>’ property in the page context, they
fantasai@5967 2002 are relative to the ‘<code class=property>font-size</code>’ of the
fantasai@5967 2003 root element. However, since a previous revision of CSS Paged Media
fantasai@5967 2004 Level 3 was ambiguous on this point, an implementation that treats
fantasai@5967 2005 ‘<code class=css>em</code>’ and ‘<code class=css>ex</code>’ on
fantasai@5967 2006 ‘<code class=property>font-size</code>’ as relative to the initial
fantasai@5967 2007 value is also conformant to CSS Paged Media Level 3. Note that this
fantasai@5967 2008 exception will be removed in Level 4.
fantasai@211 2009
fantasai@211 2010 <li>Percentage values on the margin and padding properties are relative
fantasai@473 2011 to the dimensions of the containing block. For right and left values,
fantasai@473 2012 percentages are relative to the width of the containing block; for top
fantasai@114 2013 and bottom values, percentages are relative to the height of the
fantasai@473 2014 containing block.
fantasai@213 2015
fantasai@5967 2016 <li>The used values of ‘<code class=property>width</code>’ and
fantasai@5967 2017 ‘<code class=property>height</code>’ have special computation rules
simon@7289 2018 for page boxes and page-margin boxes; see <a href="#page-size">Page
simon@7289 2019 Size</a> and <a href="#margin-box-dimensions">Computing Page-Margin Box
fantasai@5967 2020 Dimensions</a>.
fantasai@114 2021
fantasai@6061 2022 <li>The page background is positioned and painted <a href="#painting">as
fantasai@6061 2023 described above</a>.
fantasai@566 2024
fantasai@566 2025 <li>The rules for counter scoping are modified <a
fantasai@566 2026 href=page-based-counters>as described below</a>.
fantasai@658 2027
simon@7435 2028 <li> As on the ‘<code class=css>::before</code>’ and ‘<code
simon@7435 2029 class=css>::after</code>’ pseudo-elements, the ‘<code
fantasai@5967 2030 class=css>normal</code>’ value of the ‘<code
fantasai@5967 2031 class=property>content</code>’ property computes to ‘<code
simon@7289 2032 class=css>none</code>’ on page-margin boxes.
simon@7289 2033
simon@7289 2034 <li>On page-margin boxes, the ‘<code
fantasai@5975 2035 class=property>vertical-align</code>’ property behaves <a
fantasai@5975 2036 href="http://www.w3.org/TR/CSS21/tables.html#height-layout">as
fantasai@5975 2037 specified for table cells</a>. It <em>always</em> performs alignment in
fantasai@5975 2038 the vertical dimension, regardless of writing mode.
fantasai@114 2039 </ul>
fantasai@114 2040
fantasai@213 2041 <p>It is <em class=RFC2119>recommended</em> that user agents establish a
fantasai@213 2042 default page margin via the user agent stylesheet that includes any
fantasai@213 2043 non-printable area. It is further <em class=RFC2119>recommended</em>
fantasai@114 2044 that authors assume that the default page area will not include
simon@6795 2045 unprintable regions.
fantasai@114 2046
fantasai@1626 2047 <h3 id=page-based-counters><span class=secno>7.1. </span>Page-based
fantasai@566 2048 counters</h3>
fantasai@566 2049
simon@6957 2050 <p>Counters can be defined and controlled within an <span
simon@6957 2051 class=css>‘<code class=css>@page</code>’</span> rule, and used as
simon@7289 2052 content in page-margin boxes. This is useful for maintaining a page
simon@7289 2053 count.
fantasai@566 2054
fantasai@566 2055 <div class=example>
fantasai@566 2056 <p>The following rules result in the placement of the current page
simon@6795 2057 number in the middle of the outside margin of each page.
fantasai@566 2058
fantasai@566 2059 <pre>
fantasai@566 2060 @page {
fantasai@566 2061 margin: 10%;
fantasai@566 2062 counter-increment: page;
fantasai@566 2063
fantasai@566 2064 @top-center {
fantasai@566 2065 font-family: sans-serif;
fantasai@566 2066 font-weight: bold;
fantasai@566 2067 font-size: 2em;
fantasai@566 2068 content: counter(page);
fantasai@566 2069 }
fantasai@566 2070 }
fantasai@566 2071 </pre>
fantasai@566 2072 </div>
fantasai@566 2073
fantasai@5967 2074 <p>A ‘<code class=property>counter-increment</code>’ within either a
fantasai@5967 2075 page or margin context causes the counter to increment with the
simon@6795 2076 generation of each page box.
fantasai@566 2077
fantasai@566 2078 <p>If a counter is reset or incremented within the page context, it is in
simon@7289 2079 scope for all page-margin boxes and obscures all counters of the same
simon@7289 2080 name within the document.
fantasai@566 2081
fantasai@566 2082 <p>If a counter is reset or incremented within a margin context, it is in
simon@7289 2083 scope for that page-margin box and obscures any counters of the same
simon@7289 2084 name in both the page context and the document.
fantasai@566 2085
fantasai@566 2086 <p>If a counter that has not been reset or incremented within the margin
fantasai@566 2087 context or the page context is used by counter() or counters() in the
simon@7289 2088 margin context, then the resultant value is exactly as if the
simon@7289 2089 page-margin box were an element within the document at the start of the
simon@7289 2090 page, inside the deepest element in the normal flow that spans the page
simon@7289 2091 break. Use of the counter in this way does not affect the calculation of
simon@7289 2092 the counter's value.
fantasai@566 2093
fantasai@5967 2094 <p>A counter named ‘<a href="#page"><code class=css>page</code></a>’
fantasai@5967 2095 is automatically created and incremented on every page of the document.
fantasai@5967 2096 Specifically, the UA must automatically create and increment such a
fantasai@5967 2097 counter as if ‘<code class=css>@page { counter-increment: page;
fantasai@5967 2098 }</code>’ were specified. The implied ‘<a href="#page"><code
fantasai@5967 2099 class=css>page</code></a>’ counter is a real counter, and can be
fantasai@5967 2100 directly affected using the ‘<code
fantasai@5967 2101 class=property>counter-increment</code>’ and ‘<code
fantasai@5967 2102 class=property>counter-reset</code>’ properties when named explicitly
fantasai@5967 2103 in those properties. It can also be used in the ‘<code
fantasai@5967 2104 class=css>counter()</code>’ and ‘<code
simon@6795 2105 class=css>counters()</code>’ function forms.
fantasai@5967 2106
fantasai@5967 2107 <p>Additionally, a counter named ‘<a href="#page"><code
fantasai@5967 2108 class=css>pages</code></a>’ is automatically created by the UA. Its
fantasai@5967 2109 value is always the total number of pages in the document. (In
fantasai@5967 2110 continuous media this is always 1.) The value of ‘<a
fantasai@5967 2111 href="#page"><code class=css>pages</code></a>’ cannot be manipulated:
fantasai@5967 2112 while ‘<code class=property>counter-reset</code>’ and ‘<code
fantasai@5967 2113 class=property>counter-increment</code>’ statements that set it are
fantasai@5967 2114 valid, they have no effect.
fantasai@1101 2115
fantasai@566 2116 <p>In all other respects, page-associated counters behave as described in
fantasai@566 2117 <a href="#CSS21" rel=biblioentry>[CSS21]<!--{{!CSS21}}--></a>, <a
fantasai@566 2118 href="TR/CSS21/generate.html#scope">Nested Counters and Scope</a> and <a
simon@6795 2119 href="http://www.w3.org/TR/CSS21/syndata.html#counter">Counters</a>.
fantasai@566 2120
simon@7289 2121 <h3 id=margin-text-alignment><span class=secno>7.2. </span>Page-margin
simon@7289 2122 boxes and default values</h3>
fantasai@566 2123
fantasai@566 2124 <p>Properties used within page or margin contexts take their initial
fantasai@566 2125 values from their respective property definitions; however, user agents
fantasai@566 2126 must behave as though the values in the following table were established
simon@6795 2127 by rules in the UA default style sheet.
fantasai@566 2128
fantasai@3574 2129 <table class=data id=margin-values
simon@7289 2130 summary="definition of page-margin box default properties">
simon@7289 2131 <caption>Table 2. Default values for Page-Margin Boxes</caption>
fantasai@566 2132
fantasai@566 2133 <thead>
fantasai@566 2134 <tr>
simon@7289 2135 <th>Page-margin box
fantasai@566 2136
fantasai@5967 2137 <th><span class=property>‘<code
fantasai@5967 2138 class=property>text-align</code>’</span>
fantasai@5967 2139
fantasai@5967 2140 <th><span class=property>‘<code
fantasai@5967 2141 class=property>vertical-align</code>’</span>
fantasai@566 2142
fantasai@566 2143 <tbody>
fantasai@566 2144 <tr>
fantasai@566 2145 <td><a href="#top-left-corner-box-def">top-left-corner</a>
fantasai@566 2146
fantasai@566 2147 <td>right
fantasai@566 2148
fantasai@566 2149 <td>middle
fantasai@566 2150
fantasai@566 2151 <tr>
fantasai@566 2152 <td><a href="#top-left-box-def">top-left</a>
fantasai@566 2153
fantasai@566 2154 <td>left
fantasai@566 2155
fantasai@566 2156 <td>middle
fantasai@566 2157
fantasai@566 2158 <tr>
fantasai@566 2159 <td><a href="#top-center-box-def">top-center</a>
fantasai@566 2160
fantasai@566 2161 <td>center
fantasai@566 2162
fantasai@566 2163 <td>middle
fantasai@566 2164
fantasai@566 2165 <tr>
fantasai@566 2166 <td><a href="#top-right-box-def">top-right</a>
fantasai@566 2167
fantasai@566 2168 <td>right
fantasai@566 2169
fantasai@566 2170 <td>middle
fantasai@566 2171
fantasai@566 2172 <tr>
fantasai@566 2173 <td><a href="#top-right-corner-box-def">top-right-corner</a>
fantasai@566 2174
fantasai@566 2175 <td>left
fantasai@566 2176
fantasai@566 2177 <td>middle
fantasai@566 2178
fantasai@566 2179 <tr>
fantasai@566 2180 <td><a href="#left-top-box-def">left-top</a>
fantasai@566 2181
fantasai@566 2182 <td>center
fantasai@566 2183
fantasai@566 2184 <td>top
fantasai@566 2185
fantasai@566 2186 <tr>
fantasai@566 2187 <td><a href="#left-middle-box-def">left-middle</a>
fantasai@566 2188
fantasai@566 2189 <td>center
fantasai@566 2190
fantasai@566 2191 <td>middle
fantasai@566 2192
fantasai@566 2193 <tr>
fantasai@566 2194 <td><a href="#left-bottom-box-def">left-bottom</a>
fantasai@566 2195
fantasai@566 2196 <td>center
fantasai@566 2197
fantasai@566 2198 <td>bottom
fantasai@566 2199
fantasai@566 2200 <tr>
fantasai@566 2201 <td><a href="#right-top-box-def">right-top</a>
fantasai@566 2202
fantasai@566 2203 <td>center
fantasai@566 2204
fantasai@566 2205 <td>top
fantasai@566 2206
fantasai@566 2207 <tr>
fantasai@566 2208 <td><a href="#right-middle-box-def">right-middle</a>
fantasai@566 2209
fantasai@566 2210 <td>center
fantasai@566 2211
fantasai@566 2212 <td>middle
fantasai@566 2213
fantasai@566 2214 <tr>
fantasai@566 2215 <td><a href="#right-bottom-box-def">right-bottom</a>
fantasai@566 2216
fantasai@566 2217 <td>center
fantasai@566 2218
fantasai@566 2219 <td>bottom
fantasai@566 2220
fantasai@566 2221 <tr>
fantasai@566 2222 <td><a href="#bottom-left-corner-box-def">bottom-left-corner</a>
fantasai@566 2223
fantasai@566 2224 <td>right
fantasai@566 2225
fantasai@566 2226 <td>middle
fantasai@566 2227
fantasai@566 2228 <tr>
fantasai@566 2229 <td><a href="#bottom-left-box-def">bottom-left</a>
fantasai@566 2230
fantasai@566 2231 <td>left
fantasai@566 2232
fantasai@566 2233 <td>middle
fantasai@566 2234
fantasai@566 2235 <tr>
fantasai@566 2236 <td><a href="#bottom-center-box-def">bottom-center</a>
fantasai@566 2237
fantasai@566 2238 <td>center
fantasai@566 2239
fantasai@566 2240 <td>middle
fantasai@566 2241
fantasai@566 2242 <tr>
fantasai@566 2243 <td><a href="#bottom-right-box-def">bottom-right</a>
fantasai@566 2244
fantasai@566 2245 <td>right
fantasai@566 2246
fantasai@566 2247 <td>middle
fantasai@566 2248
fantasai@566 2249 <tr>
fantasai@566 2250 <td><a href="#bottom-right-corner-box-def">bottom-right-corner</a>
fantasai@566 2251
fantasai@566 2252 <td>left
fantasai@566 2253
fantasai@566 2254 <td>middle
fantasai@566 2255 </table>
fantasai@566 2256
fantasai@566 2257 <div class=example>
fantasai@566 2258 <p>This example style sheet could be used to create a centered header
simon@6795 2259 with the current chapter name:
fantasai@566 2260
fantasai@566 2261 <pre>body {counter-reset: chapter;}
fantasai@566 2262 div.chapter {counter-increment: chapter;}
fantasai@566 2263 @page {
fantasai@566 2264 margin: 10%;
fantasai@566 2265 @top-center { content: "Chapter" counter(chapter) }
fantasai@566 2266 }
fantasai@566 2267 </pre>
fantasai@566 2268 </div>
fantasai@566 2269
fantasai@3574 2270 <h2 id=page-size><span class=secno>8. </span>Page Size</h2>
fantasai@528 2271
fantasai@528 2272 <p>People around the world use many different paper sizes. It is a goal
fantasai@528 2273 of this specification that web content should be adaptable to a range of
fantasai@528 2274 different sizes without having to write a specific style sheet for each
simon@6795 2275 paper size.
fantasai@528 2276
fantasai@528 2277 <p>However, in some situations it is important that a certain page size
fantasai@528 2278 achieves a certain style. One way to achieve this goal is to utilize the
fantasai@5967 2279 ‘<a href="#size"><code class=property>size</code></a>’ property,
fantasai@5967 2280 which indicates that the document should preferentially be displayed on
fantasai@5967 2281 a surface of a certain size; another method is to use Media Queries <a
fantasai@5967 2282 href="#MEDIAQ" rel=biblioentry>[MEDIAQ]<!--{{MEDIAQ}}--></a> which allow
simon@6795 2283 different style sheets to be applied to different page sizes.
fantasai@5967 2284
fantasai@5967 2285 <h3 id=page-size-prop><span class=secno>8.1. </span>Page size: the ‘<a
fantasai@5967 2286 href="#size"><code class=property>size</code></a>’ property</h3>
fantasai@5967 2287
fantasai@1052 2288 <table class=propdef summary="definition of the size property">
fantasai@528 2289 <tbody>
fantasai@528 2290 <tr>
fantasai@528 2291 <th>Name:
fantasai@528 2292
fantasai@528 2293 <td><dfn id=size>size</dfn>
fantasai@528 2294
fantasai@528 2295 <tr>
fantasai@528 2296 <th>Value:
fantasai@528 2297
fantasai@1124 2298 <td>&lt;length&gt;{1,2} | auto | [ &lt;page-size&gt; || [ portrait |
fantasai@1124 2299 landscape] ]
fantasai@528 2300
fantasai@528 2301 <tr>
fantasai@528 2302 <th>Initial:
fantasai@528 2303
fantasai@528 2304 <td>auto
fantasai@528 2305
fantasai@528 2306 <tr>
fantasai@528 2307 <td><em>Applies to:</em>
fantasai@528 2308
fantasai@528 2309 <td>page context
fantasai@528 2310
fantasai@528 2311 <tr>
fantasai@528 2312 <th>Inherited:
fantasai@528 2313
fantasai@528 2314 <td>N/A
fantasai@528 2315
fantasai@528 2316 <tr>
fantasai@528 2317 <th>Percentages:
fantasai@528 2318
fantasai@528 2319 <td>N/A
fantasai@528 2320
fantasai@528 2321 <tr>
fantasai@528 2322 <th>Media:
fantasai@528 2323
fantasai@528 2324 <td>paged
fantasai@528 2325
fantasai@528 2326 <tr>
fantasai@528 2327 <td><em>Computed value:</em>
fantasai@528 2328
fantasai@528 2329 <td>specified value
fantasai@528 2330 </table>
fantasai@528 2331
fantasai@3574 2332 <p>This property specifies the target size and orientation of the <a
fantasai@5973 2333 href="#page-box">page box</a>‘<code class=css>s containing block. In
fantasai@5973 2334 the general case, where one page box is rendered onto one <a
fantasai@5973 2335 href="#page-sheet">page sheet</a>, the </code>’size' property also
fantasai@5973 2336 indicates the size of the destination page sheet.
fantasai@528 2337
fantasai@528 2338 <p>The size of a page box can either be "absolute" (fixed size) or
fantasai@5987 2339 "scalable" (i.e., fitting available sheet sizes). The first three values
fantasai@5987 2340 in the table below can be used to create scalable page boxes. Other
fantasai@5987 2341 values define a fixed-size page box, and thereby indicate the preferred
fantasai@5987 2342 output media size. When possible, output should be rendered on the media
fantasai@5987 2343 size indicated. If the specified size is not available, the rules for <a
fantasai@5987 2344 href="#renderingpages">transposing a page box to a different size</a>
simon@6795 2345 apply.
fantasai@528 2346
fantasai@4555 2347 <p>If a <a href="#size"><code>size</code></a> property declaration is
fantasai@5967 2348 qualified by a ‘<code class=css>width</code>’, ‘<code
fantasai@5967 2349 class=css>height</code>’, ‘<code class=css>device-width</code>’,
fantasai@5967 2350 ‘<code class=css>device-height</code>’, ‘<code
fantasai@5967 2351 class=css>aspect-ratio</code>’, ‘<code
fantasai@5967 2352 class=css>device-aspect-ratio</code>’ or ‘<code
fantasai@5967 2353 class=css>orientation</code>’ media query <a href="#MEDIAQ"
fantasai@4555 2354 rel=biblioentry>[MEDIAQ]<!--{{!MEDIAQ}}--></a> (or other conditional on
fantasai@4555 2355 the size of the paper), then the declaration must be <a
fantasai@4568 2356 href="http://www.w3.org/TR/CSS21/conform.html#ignore">ignored</a>. Media
fantasai@5967 2357 queries do not honor ‘<a href="#size"><code
fantasai@5967 2358 class=property>size</code></a>’: they assume the paper size that would
simon@6795 2359 be chosen if no @page rules were specified.
fantasai@528 2360
fantasai@5987 2361 <p class=issue>It would be useful if media queries could respond at least
fantasai@5987 2362 to sizes specified on an unqualified @page.
fantasai@5987 2363
fantasai@528 2364 <div class=example>
fantasai@657 2365 <p>In the following example
fantasai@528 2366
fantasai@528 2367 <pre>
fantasai@528 2368 @page {
fantasai@528 2369 size: 4in 6in;
fantasai@528 2370 }
simon@6957 2371
fantasai@528 2372 @media (max-width: 6in) {
fantasai@528 2373 @page {
fantasai@528 2374 size: letter;
fantasai@528 2375 }
fantasai@528 2376 }
fantasai@528 2377 </pre>
fantasai@528 2378
fantasai@2094 2379 <p>The second <a href="#size"><code>size</code></a> declaration is
fantasai@2094 2380 ignored, i.e. the specified value of the <a
fantasai@2094 2381 href="#size"><code>size</code></a> property is <code>4in 6in</code>.
fantasai@528 2382 </div>
fantasai@528 2383
fantasai@528 2384 <table class=page-sizes>
fantasai@528 2385 <tbody>
fantasai@528 2386 <tr>
fantasai@528 2387 <th>Value
fantasai@528 2388
fantasai@528 2389 <th>Description
fantasai@528 2390
fantasai@528 2391 <tr>
fantasai@528 2392 <td>auto
fantasai@528 2393
fantasai@528 2394 <td>The page box will be set to a size and orientation chosen by the
fantasai@528 2395 UA. In the usual case, the page box size and orientation is chosen to
fantasai@528 2396 match the target media sheet.
fantasai@528 2397
fantasai@528 2398 <tr>
fantasai@528 2399 <td>landscape
fantasai@528 2400
fantasai@528 2401 <td>Specifies that the page's content be printed in landscape
fantasai@528 2402 orientation. The longer sides of the page box are horizontal. If a
fantasai@5967 2403 <span class=css>‘<code class=css>&lt;page-size&gt;</code>’</span>
fantasai@5967 2404 is not specified, the size of the page sheet is chosen by the UA.
fantasai@528 2405
fantasai@528 2406 <tr>
fantasai@528 2407 <td>portrait
fantasai@528 2408
fantasai@528 2409 <td>Specifies that the page's content be printed in portrait
fantasai@528 2410 orientation. The shorter sides of the page box are horizontal. If a
fantasai@5967 2411 <span class=css>‘<code class=css>&lt;page-size&gt;</code>’</span>
fantasai@5967 2412 is not specified, the size of the page sheet is chosen by the UA.
fantasai@528 2413
fantasai@528 2414 <tr>
fantasai@528 2415 <td>&lt;length&gt;
fantasai@528 2416
fantasai@528 2417 <td>The page box will be set to the given absolute dimension(s). If
fantasai@528 2418 only one length value is specified, it sets both the width and height
fantasai@528 2419 of the page box (i.e., the box is a square). If two length values are
fantasai@528 2420 specified, the first establishes the page box width, and the second
fantasai@5967 2421 the page box height. Values in units of <span class=css>‘<code
fantasai@5967 2422 class=property>em</code>’</span> and <span class=css>‘<code
fantasai@5967 2423 class=property>ex</code>’</span> refer to the page context's font.
fantasai@5988 2424 Negative lengths are illegal.
fantasai@528 2425
fantasai@528 2426 <tr>
fantasai@528 2427 <td>&lt;page-size&gt;
fantasai@528 2428
fantasai@528 2429 <td>A page size can be specified using one of the following media
fantasai@528 2430 names. This is the equivalent of specifying the <span
fantasai@5967 2431 class=css>‘<code class=css>&lt;page-size&gt;</code>’</span> using
fantasai@5967 2432 length values. The definition of the the media names comes from
fantasai@5967 2433 <cite>Media Standardized Names</cite> <a href="#PWGMSN"
fantasai@528 2434 rel=biblioentry>[PWGMSN]<!--{{!PWGMSN}}--></a>.
fantasai@528 2435 <dl>
fantasai@528 2436 <dt>A5
fantasai@528 2437
fantasai@528 2438 <dd>Equivalent to the size of ISO A5 media: 148mm wide and 210 mm
fantasai@528 2439 high.
fantasai@528 2440
fantasai@528 2441 <dt>A4
fantasai@528 2442
simon@6795 2443 <dd>Equivalent to the size of ISO A4 media: 210 mm wide and 297 mm
fantasai@528 2444 high.
fantasai@528 2445
fantasai@528 2446 <dt>A3
fantasai@528 2447
fantasai@528 2448 <dd>Equivalent to the size of ISO A3 media: 297mm wide and 420mm
fantasai@528 2449 high.
fantasai@528 2450
fantasai@528 2451 <dt>B5
fantasai@528 2452
fantasai@528 2453 <dd>Equivalent to the size of ISO B5 media: 176mm wide by 250mm
fantasai@528 2454 high.
fantasai@528 2455
fantasai@528 2456 <dt>B4
fantasai@528 2457
fantasai@528 2458 <dd>Equivalent to the size of ISO B4 media: 250mm wide by 353mm
fantasai@528 2459 high.
fantasai@528 2460
fantasai@528 2461 <dt>letter
fantasai@528 2462
fantasai@528 2463 <dd>Equivalent to the size of North American letter media: 8.5
fantasai@528 2464 inches wide and 11 inches high
fantasai@528 2465
fantasai@528 2466 <dt>legal
fantasai@528 2467
fantasai@528 2468 <dd>Equivalent to the size of North American legal: 8.5 inches wide
fantasai@528 2469 by 14 inches high.
fantasai@528 2470
fantasai@528 2471 <dt>ledger
fantasai@528 2472
fantasai@528 2473 <dd>Equivalent to the size of North American ledger: 11 inches wide
fantasai@528 2474 by 17 inches high.
fantasai@528 2475 </dl>
fantasai@528 2476 </table>
fantasai@528 2477
fantasai@5967 2478 <p>The ‘<code class=css>&lt;page-size&gt;</code>’ names can be used
fantasai@5967 2479 in conjunction with ‘<code class=property>landscape</code>’ or
fantasai@5967 2480 ‘<code class=property>portrait</code>’ to indicate both size and
simon@6795 2481 orientation.
fantasai@528 2482
fantasai@1626 2483 <h4 id=some-examples><span class=secno>8.1.1. </span>Some examples:</h4>
fantasai@114 2484
fantasai@213 2485 <div class=example>
fantasai@213 2486 <pre>
fantasai@528 2487 @page {
fantasai@528 2488 size: A4 landscape;
fantasai@213 2489 }
fantasai@528 2490 </pre>
fantasai@528 2491
fantasai@528 2492 <p>The above example sets the width of the page box to be 297mm and the
fantasai@528 2493 height to be 210mm. The page box in this example should be rendered on
simon@6795 2494 a page sheet size of 210 mm by 297 mm.
fantasai@528 2495 </div>
fantasai@528 2496
fantasai@528 2497 <div class=example>
fantasai@528 2498 <p>In the following example, the outer edges of the page box will align
fantasai@528 2499 with the page. The percentage value on the <span
fantasai@5967 2500 class=property>‘<code class=property>margin</code>’</span> property
fantasai@5967 2501 is relative to the page size so if the page sheet dimensions are 210mm
fantasai@5967 2502 x 297mm (i.e., A4), the margins are 21mm and 29.7mm. Assuming there are
fantasai@5967 2503 no page borders or padding set in the UA default style sheet, the
simon@6795 2504 resulting page area is 189mm by 367.3mm (210mm-21mm by 297mm-29.7mm).
fantasai@528 2505
fantasai@528 2506 <pre>
fantasai@528 2507 @page {
fantasai@528 2508 size: auto;/* auto is the initial value */
fantasai@528 2509 margin: 10%;
fantasai@213 2510 }
fantasai@211 2511 </pre>
fantasai@114 2512 </div>
fantasai@114 2513
fantasai@213 2514 <div class=example>
fantasai@213 2515 <pre>
fantasai@528 2516 @page {
fantasai@528 2517 size: 8.5in 11in;/* width height */
fantasai@213 2518 }
fantasai@211 2519 </pre>
fantasai@528 2520
fantasai@528 2521 <p>The above example sets the width of the page box to be 8.5 inches and
fantasai@528 2522 the height to be 11 inches. This indicates that the page sheet size
fantasai@5967 2523 should be 8.5"x11" and the orientation ‘<code
simon@6795 2524 class=property>portrait</code>’.
fantasai@114 2525 </div>
fantasai@114 2526
fantasai@1626 2527 <h4 id=page-size-media-query><span class=secno>8.1.2. </span>Media
fantasai@1626 2528 Queries</h4>
fantasai@528 2529
simon@6795 2530 <p>This section is informative.
fantasai@528 2531
fantasai@528 2532 <p>By using Media Queries <a href="#MEDIAQ"
fantasai@528 2533 rel=biblioentry>[MEDIAQ]<!--{{MEDIAQ}}--></a>, one style sheet can
fantasai@528 2534 express different stylistic preferences for different page sizes.
simon@6795 2535 Consider this example:
fantasai@528 2536
fantasai@528 2537 <div class=example style="font-size: 10pt;">
fantasai@213 2538 <pre>
simon@6957 2539 /* style sheet for "A4" printing */
fantasai@528 2540 @media print and (width: 21cm) and (height: 29.7cm) {
fantasai@528 2541 @page {
fantasai@528 2542 margin: 3cm;
fantasai@528 2543 }
fantasai@528 2544 }
simon@6957 2545
fantasai@528 2546 /* style sheet for "letter" printing */
fantasai@528 2547 @media print and (width: 8.5in) and (height: 11in) {
fantasai@528 2548 @page {
fantasai@528 2549 margin: 1in;
fantasai@528 2550 }
fantasai@528 2551 }
fantasai@114 2552 </pre>
fantasai@114 2553 </div>
fantasai@114 2554
fantasai@528 2555 <p>In the example above, "A4" sheets are given a "3cm" page margin, and
simon@6795 2556 "letter" sheets are given a "1in" page margin.
fantasai@528 2557
fantasai@1626 2558 <h3 id=renderingpages><span class=secno>8.2. </span>Rendering page boxes
fantasai@528 2559 that do not fit a page sheet</h3>
fantasai@528 2560
fantasai@528 2561 <p>If a page box does not match the target page sheet dimensions, the
simon@6795 2562 user agent should do one of the following (in order of preference):
fantasai@528 2563
fantasai@528 2564 <ol>
fantasai@528 2565 <li>Render the page box at the indicated size on a larger page sheet.
fantasai@528 2566
fantasai@528 2567 <li>Rotate the page box 90° if this will make the page box fit the page
fantasai@528 2568 sheet.
fantasai@528 2569
fantasai@528 2570 <li>Scale the page box to fit the page sheet. (The aspect ratio of the
fantasai@528 2571 page box <em class=RFC2119>should</em> be preserved.)
fantasai@528 2572
fantasai@5967 2573 <li>Reformat the page contents, including ‘<code
fantasai@5967 2574 class=property>spilling</code>’ onto other page sheets.
fantasai@528 2575
fantasai@528 2576 <li>Clip overflowed content (least preferred).
fantasai@528 2577 </ol>
fantasai@528 2578
fantasai@528 2579 <p>The user agent <em class=RFC2119>MAY</em> wish to consult the user
simon@6795 2580 before performing these operations.
fantasai@528 2581
fantasai@1626 2582 <h3 id=positioning-page-box><span class=secno>8.3. </span>Positioning the
fantasai@528 2583 page box on the sheet</h3>
fantasai@528 2584
fantasai@528 2585 <p>When the page box is smaller than the page size, the user agent <em
simon@6795 2586 class=RFC2119>SHOULD</em> either:
fantasai@114 2587
fantasai@114 2588 <ul>
fantasai@528 2589 <li>center the page box on the sheet since this will align double-sided
fantasai@528 2590 pages and avoid accidental loss of information that is printed near the
fantasai@528 2591 edge of the sheet; or
fantasai@528 2592
fantasai@528 2593 <li>position the page box in the upper left corner of the page sheet, as
fantasai@528 2594 this may minimize media consumption.
fantasai@114 2595 </ul>
fantasai@528 2596
fantasai@528 2597 <p>The user agent <em class=RFC2119>MAY</em> wish to consult the user in
fantasai@528 2598 this regard.</p>
fantasai@528 2599 <!-- "Page selector and page context" -->
simon@7430 2600 <h2 id=page-breaks><span class=secno>9. </span> <a
simon@7430 2601 id=pg-br-before-after></a> <a id=page-break-before></a> <a
simon@7430 2602 id=page-break-after></a> <a id=page-break-inside></a> <a
simon@7430 2603 id=breaks-inside></a> <a id=orphans></a> <a id=widows></a> <a
simon@7430 2604 id=allowed-pg-brk></a> <a id=brk-btw-blocks></a> <a
simon@7430 2605 id=brk-btw-lines></a> <a id=brk-end-block></a> <a id=forced-pg-brk></a>
simon@7430 2606 <a id=best-pg-brk></a> Page Breaks</h2>
simon@7430 2607
simon@7430 2608 <p> The <a href="#CSS3-BREAK"
simon@7430 2609 rel=biblioentry>[CSS3-BREAK]<!--{{!CSS3-BREAK}}--></a> module defines
simon@7430 2610 how and where CSS boxes can be <i>fragmented</i>, including across page
simon@7430 2611 breaks. It defines a few properties that indicate where the user agent
simon@7430 2612 <em class=RFC2119>MAY</em> or <em class=RFC2119>MUST</em> break pages,
simon@7430 2613 and on what page (left or right) the subsequent content resumes. Each
fantasai@213 2614 page break ends layout in the current <a href="#page-box">page box</a>
fantasai@213 2615 and causes remaining pieces of the document tree to be laid out in a new
simon@6795 2616 page box.
fantasai@213 2617
simon@7430 2618 <h3 id=using-named-pages><span class=secno>9.1. </span>Using named pages:
simon@7430 2619 ‘<a href="#page"><code class=property>page</code></a>’</h3>
fantasai@211 2620
fantasai@1052 2621 <table class=propdef summary="property definition">
fantasai@114 2622 <tbody>
fantasai@114 2623 <tr>
fantasai@213 2624 <th>Name:
fantasai@213 2625
simon@7430 2626 <td><dfn id=page>page</dfn>
fantasai@114 2627
fantasai@114 2628 <tr>
fantasai@213 2629 <th>Value:
fantasai@213 2630
simon@7430 2631 <td>auto | &lt;identifier&gt;
fantasai@114 2632
fantasai@114 2633 <tr>
fantasai@213 2634 <th>Initial:
fantasai@213 2635
fantasai@213 2636 <td>auto
fantasai@114 2637
fantasai@114 2638 <tr>
fantasai@213 2639 <th>Applies to:
fantasai@213 2640
simon@7430 2641 <td>block-level elements
fantasai@114 2642
fantasai@114 2643 <tr>
fantasai@213 2644 <th>Inherited:
fantasai@213 2645
simon@7430 2646 <td>no (but see prose)
fantasai@114 2647
fantasai@114 2648 <tr>
fantasai@213 2649 <th>Percentages:
fantasai@213 2650
fantasai@213 2651 <td>N/A
fantasai@114 2652
fantasai@114 2653 <tr>
fantasai@213 2654 <th>Media:
fantasai@213 2655
fantasai@213 2656 <td>paged
fantasai@114 2657
fantasai@114 2658 <tr>
fantasai@213 2659 <th>Computed value:
fantasai@213 2660
fantasai@213 2661 <td>specified value
fantasai@114 2662 </table>
fantasai@114 2663
simon@7430 2664 <p>The ‘<a href="#page"><code class=property>page</code></a>’
simon@7430 2665 property is used to specify a particular type of page on which an
simon@7430 2666 element <em class=RFC2119>MUST</em> be displayed.
fantasai@213 2667
fantasai@213 2668 <div class=example>
fantasai@213 2669 <p>This example will put all tables on a right-hand side landscape page
simon@6795 2670 (named "rotated"):
fantasai@114 2671
fantasai@213 2672 <pre>
fantasai@213 2673 @page rotated { size: landscape }
fantasai@213 2674 table { page: rotated; page-break-before: right }
fantasai@211 2675 </pre>
fantasai@114 2676 </div>
fantasai@114 2677
simon@7430 2678 <p> The ‘<a href="#page"><code class=property>page</code></a>’
simon@7430 2679 property works as follows: If a block box with inline content has a
simon@7430 2680 ‘<a href="#page"><code class=property>page</code></a>’ property that
simon@7430 2681 is different from the preceding block box with inline content, then one
simon@7430 2682 or two page breaks are inserted between them, and the boxes after the
simon@7430 2683 break are rendered on a page box of the named type.
simon@7430 2684
simon@7430 2685 <p> In addition to breaks defined in <a href="#CSS3-BREAK"
simon@7430 2686 rel=biblioentry>[CSS3-BREAK]<!--{{!CSS3-BREAK}}--></a>, a <a
simon@7430 2687 href="http://www.w3.org/TR/css3-break/#btw-blocks">Class 1</a> page
simon@7430 2688 break <em class=RFC2119>MUST</em> also occur in the margin between
simon@7430 2689 sibling boxes if the last line box before this margin and the first one
simon@7430 2690 after it do not have the same value for ‘<a href="#page"><code
simon@7430 2691 class=property>page</code></a>’.
fantasai@5967 2692
fantasai@5967 2693 <p>The ‘<a href="#page"><code class=property>page</code></a>’
fantasai@5967 2694 property does not inherit. However, if the ‘<a href="#page"><code
fantasai@5967 2695 class=property>page</code></a>’ value on an element is ‘<code
fantasai@5967 2696 class=css>auto</code>’, then it is treated as having the same name as
fantasai@5967 2697 its nearest ancestor with a non-auto value. When indicated on the root
simon@6795 2698 element, the effective name is the empty string.
fantasai@1053 2699
fantasai@1053 2700 <p>Because a previous version of this specification indicated that the
fantasai@5967 2701 ‘<a href="#page"><code class=property>page</code></a>’ property is
fantasai@5967 2702 inherited, an implementation that inherits the ‘<a href="#page"><code
fantasai@5967 2703 class=property>page</code></a>’ property and treats ‘<code
fantasai@5967 2704 class=css>auto</code>’ as always naming the empty string remains
fantasai@5967 2705 conformant to CSS3 Paged Media. Therefore authors should not explicitly
fantasai@5967 2706 specify the ‘<code class=css>auto</code>’ value on a descendant of
fantasai@5967 2707 an element with a non-‘<code class=css>auto</code>’ ‘<a
fantasai@5967 2708 href="#page"><code class=property>page</code></a>’ value as the
fantasai@1053 2709 resulting behavior will be unpredictable.
fantasai@114 2710
fantasai@5967 2711 <p>Page names are case-sensitive identifiers. However the ‘<code
fantasai@5967 2712 class=css>auto</code>’ value, being a CSS keyword, is <a
simon@7430 2713 href="http://www.w3.org/TR/CSS21/syndata.html#characters">ASCII
simon@7430 2714 case-insensitive</a>.
fantasai@1054 2715
fantasai@213 2716 <div class=example>
fantasai@213 2717 <p>In this example, the two tables are rendered on landscape pages
fantasai@114 2718 (indeed, on the same page, if they fit). The page type "narrow" is used
fantasai@114 2719 for the &lt;p&gt; after the second table, as the page properties for
simon@6795 2720 the table element are no longer in effect:
fantasai@114 2721
fantasai@213 2722 <pre>
fantasai@213 2723 @page narrow { size: 9cm 18cm }
fantasai@213 2724 @page rotated { size: landscape }
fantasai@213 2725 div { page: narrow }
fantasai@213 2726 table { page: rotated }
fantasai@211 2727 </pre>
fantasai@114 2728 with this document:
fantasai@213 2729 <pre>
fantasai@213 2730 &lt;div&gt;
fantasai@213 2731 &lt;table&gt;...&lt;/table&gt;
fantasai@213 2732 &lt;table&gt;...&lt;/table&gt;
fantasai@213 2733 &lt;p&gt;This text is rendered on a 'narrow' page&lt;/p&gt;
fantasai@213 2734 &lt;/div&gt;
fantasai@211 2735 </pre>
fantasai@114 2736 </div>
fantasai@114 2737
fantasai@6813 2738 <div class=example>
fantasai@6813 2739 <p>In Japanese documents, sometimes different parts of a single document
fantasai@6813 2740 will have different <i lang=ja-Latn>kihon hanmen</i>. <a href="#JLREQ"
fantasai@6813 2741 rel=biblioentry>[JLREQ]<!--{{JLREQ}}--></a> The ‘<a
fantasai@6813 2742 href="#page"><code class=property>page</code></a>’ property, together
simon@6957 2743 with ‘<code class=css>@page</code>’ rules specifying different page
simon@6957 2744 widths, can accomodate this type of layout:
fantasai@6813 2745
fantasai@6813 2746 <pre>
fantasai@6813 2747 &lt;!DOCTYPE html>
fantasai@6813 2748 &lt;html lang="ja">
fantasai@6813 2749 &lt;style>
fantasai@6813 2750 html { writing-mode: vertical-rl;
fantasai@6813 2751 line-height: 1.6; }
fantasai@6813 2752 .main { page: main;
fantasai@6813 2753 columns: 2; column-gap: 1rem; }
fantasai@6813 2754 .index { page: index;
fantasai@6813 2755 columns: 3; column-gap: 1rem; }
fantasai@6813 2756 @page { margin: auto; /* center kihon hanmen on page */
fantasai@6813 2757 width: 40rem; } /* 1.6 × 25 lines */
fantasai@6813 2758 @page main { height: 61rem; } /* 2 × 30 chars + 1 × gap */
fantasai@6813 2759 @page index { height: 62rem; } /* 3 × 20 chars + 2 × gap */
fantasai@6813 2760 &lt;/style>
fantasai@6813 2761 &lt;section class="main"> ... &lt;/section>
fantasai@6813 2762 &lt;section class="index"> ... &lt;/section>
fantasai@6813 2763 &lt;/html>
fantasai@6813 2764 </pre>
fantasai@6813 2765 </div>
fantasai@6813 2766
fantasai@1626 2767 <h2 id=image-properties><span class=secno>10. </span>Image Properties</h2>
fantasai@566 2768
simon@7428 2769 <p class=note>This section has been moved to <a href="#CSS3-IMAGES"
simon@7428 2770 rel=biblioentry>[CSS3-IMAGES]<!--{{CSS3-IMAGES}}--></a>.
fantasai@213 2771
fantasai@563 2772 <h2 class=no-num id=properties-list>Appendix A: Applicable CSS2.1
fantasai@563 2773 Properties</h2>
fantasai@528 2774
fantasai@1052 2775 <h3 class=no-num id=properties-that-apply-within-the-page-co>Properties
fantasai@1052 2776 that apply within the page context</h3>
fantasai@213 2777
fantasai@213 2778 <p>The following CSS 2.1 <a href="#CSS21"
fantasai@562 2779 rel=biblioentry>[CSS21]<!--{{!CSS21}}--></a> properties apply to the
fantasai@563 2780 page box. If a conforming user agent supports any of these properties on
simon@6795 2781 block boxes, then it must also support that property for the page box.
fantasai@213 2782
fantasai@213 2783 <table class=property-list>
fantasai@114 2784 <tbody>
fantasai@114 2785 <tr>
fantasai@5976 2786 <td rowspan=2><a
fantasai@5976 2787 href="http://www.w3.org/TR/CSS21/visuren.html#direction">bidi
fantasai@563 2788 properties</a>
fantasai@563 2789
fantasai@563 2790 <td>direction
fantasai@563 2791
fantasai@563 2792 <tbody>
fantasai@563 2793 <tr>
fantasai@213 2794 <td rowspan=6><a
fantasai@5976 2795 href="http://www.w3.org/TR/CSS21/colors.html#background-properties">background
fantasai@213 2796 properties</a>
fantasai@213 2797
fantasai@213 2798 <td>background-color
fantasai@114 2799
fantasai@114 2800 <tr>
fantasai@213 2801 <td>background-image
fantasai@114 2802
fantasai@114 2803 <tr>
fantasai@213 2804 <td>background-repeat
fantasai@114 2805
fantasai@114 2806 <tr>
fantasai@213 2807 <td>background-attachment
fantasai@114 2808
fantasai@114 2809 <tr>
fantasai@213 2810 <td>background-position
fantasai@114 2811
fantasai@114 2812 <tr>
fantasai@213 2813 <td>background
fantasai@114 2814
fantasai@561 2815 <tbody>
fantasai@114 2816 <tr>
fantasai@5976 2817 <td rowspan=20><a
fantasai@5976 2818 href="http://www.w3.org/TR/CSS21/box.html#border-properties">border
fantasai@213 2819 properties</a>
fantasai@213 2820
fantasai@213 2821 <td>border-top-width
fantasai@114 2822
fantasai@114 2823 <tr>
fantasai@213 2824 <td>border-right-width
fantasai@114 2825
fantasai@114 2826 <tr>
fantasai@213 2827 <td>border-bottom-width
fantasai@114 2828
fantasai@114 2829 <tr>
fantasai@213 2830 <td>border-left-width
fantasai@114 2831
fantasai@114 2832 <tr>
fantasai@213 2833 <td>border-width
fantasai@114 2834
fantasai@114 2835 <tr>
fantasai@213 2836 <td>border-top-color
fantasai@114 2837
fantasai@114 2838 <tr>
fantasai@213 2839 <td>border-right-color
fantasai@114 2840
fantasai@114 2841 <tr>
fantasai@213 2842 <td>border-bottom-color
fantasai@114 2843
fantasai@114 2844 <tr>
fantasai@213 2845 <td>border-left-color
fantasai@114 2846
fantasai@114 2847 <tr>
fantasai@213 2848 <td>border-color
fantasai@114 2849
fantasai@114 2850 <tr>
fantasai@213 2851 <td>border-top-style
fantasai@114 2852
fantasai@114 2853 <tr>
fantasai@213 2854 <td>border-right-style
fantasai@114 2855
fantasai@114 2856 <tr>
fantasai@213 2857 <td>border-bottom-style
fantasai@114 2858
fantasai@114 2859 <tr>
fantasai@213 2860 <td>border-left-style
fantasai@114 2861
fantasai@114 2862 <tr>
fantasai@213 2863 <td>border-short-style
fantasai@114 2864
fantasai@114 2865 <tr>
fantasai@213 2866 <td>border-top
fantasai@114 2867
fantasai@114 2868 <tr>
fantasai@213 2869 <td>border-right
fantasai@114 2870
fantasai@114 2871 <tr>
fantasai@213 2872 <td>border-bottom
fantasai@114 2873
fantasai@114 2874 <tr>
fantasai@213 2875 <td>border-left
fantasai@114 2876
fantasai@114 2877 <tr>
fantasai@213 2878 <td>border
fantasai@114 2879
fantasai@561 2880 <tbody>
fantasai@114 2881 <tr>
fantasai@5976 2882 <td rowspan=2><a
fantasai@5976 2883 href="http://www.w3.org/TR/CSS21/generate.html#counters">counter
fantasai@563 2884 properties</a>
fantasai@213 2885
fantasai@213 2886 <td>counter-reset
fantasai@114 2887
fantasai@114 2888 <tr>
fantasai@213 2889 <td>counter-increment
fantasai@114 2890
fantasai@561 2891 <tbody>
fantasai@114 2892 <tr>
fantasai@5976 2893 <td colspan=2><a
fantasai@5976 2894 href="http://www.w3.org/TR/CSS21/colors.html#propdef-color">color</a>
fantasai@114 2895
fantasai@561 2896 <tbody>
fantasai@114 2897 <tr>
fantasai@5976 2898 <td rowspan=6><a href="http://www.w3.org/TR/CSS21/fonts.html">font
fantasai@5976 2899 properties</a>
fantasai@213 2900
fantasai@213 2901 <td>font-family
fantasai@114 2902
fantasai@114 2903 <tr>
fantasai@563 2904 <td>font-size
fantasai@563 2905
fantasai@563 2906 <tr>
fantasai@213 2907 <td>font-style
fantasai@114 2908
fantasai@114 2909 <tr>
fantasai@213 2910 <td>font-variant
fantasai@114 2911
fantasai@114 2912 <tr>
fantasai@213 2913 <td>font-weight
fantasai@114 2914
fantasai@114 2915 <tr>
fantasai@213 2916 <td>font
fantasai@114 2917
fantasai@561 2918 <tbody>
fantasai@114 2919 <tr>
fantasai@3574 2920 <td rowspan=3><a
fantasai@5976 2921 href="http://www.w3.org/TR/CSS21/visudet.html#the-height-property">height</a>
fantasai@5976 2922 <a
fantasai@5976 2923 href="http://www.w3.org/TR/CSS21/visudet.html#min-max-heights">properties</a>
fantasai@3574 2924
fantasai@3574 2925 <td>height
fantasai@3574 2926
fantasai@3574 2927 <tr>
fantasai@3574 2928 <td>min-height
fantasai@3574 2929
fantasai@3574 2930 <tr>
fantasai@3574 2931 <td>max-height
fantasai@3574 2932
fantasai@3574 2933 <tbody>
fantasai@3574 2934 <tr>
fantasai@213 2935 <td colspan=2><a
fantasai@5976 2936 href="http://www.w3.org/TR/CSS21/visudet.html#line-height">line-height</a>
fantasai@114 2937
fantasai@561 2938 <tbody>
fantasai@114 2939 <tr>
fantasai@5976 2940 <td rowspan=5><a
fantasai@5976 2941 href="http://www.w3.org/TR/CSS21/box.html#margin-properties">margin
fantasai@213 2942 properties</a>
fantasai@213 2943
fantasai@213 2944 <td>margin-top
fantasai@114 2945
fantasai@114 2946 <tr>
fantasai@213 2947 <td>margin-right
fantasai@114 2948
fantasai@114 2949 <tr>
fantasai@213 2950 <td>margin-bottom
fantasai@114 2951
fantasai@114 2952 <tr>
fantasai@213 2953 <td>margin-left
fantasai@114 2954
fantasai@114 2955 <tr>
fantasai@213 2956 <td>margin
fantasai@114 2957
fantasai@561 2958 <tbody>
fantasai@114 2959 <tr>
fantasai@5976 2960 <td rowspan=5><a
fantasai@5976 2961 href="http://www.w3.org/TR/CSS21/ui.html#dynamic-outlines">outline
fantasai@563 2962 properties</a>
fantasai@563 2963
fantasai@563 2964 <td>outline-width
fantasai@563 2965
fantasai@563 2966 <tr>
fantasai@563 2967 <td>outline-style
fantasai@563 2968
fantasai@563 2969 <tr>
fantasai@563 2970 <td>outline-color
fantasai@563 2971
fantasai@563 2972 <tr>
fantasai@563 2973 <td>outline
fantasai@563 2974
fantasai@563 2975 <tbody>
fantasai@563 2976 <tr>
fantasai@5976 2977 <td rowspan=5><a
fantasai@5976 2978 href="http://www.w3.org/TR/CSS21/box.html#padding-properties">padding
fantasai@213 2979 properties</a>
fantasai@213 2980
fantasai@213 2981 <td>padding-top
fantasai@114 2982
fantasai@114 2983 <tr>
fantasai@213 2984 <td>padding-right
fantasai@211 2985
fantasai@211 2986 <tr>
fantasai@213 2987 <td>padding-bottom
fantasai@211 2988
fantasai@211 2989 <tr>
fantasai@213 2990 <td>padding-left
fantasai@211 2991
fantasai@211 2992 <tr>
fantasai@213 2993 <td>padding
fantasai@211 2994
fantasai@561 2995 <tbody>
fantasai@211 2996 <tr>
fantasai@563 2997 <td colspan=2><a
fantasai@5976 2998 href="http://www.w3.org/TR/CSS21/generate.html#quotes-specify">quotes</a>
fantasai@211 2999
fantasai@561 3000 <tbody>
fantasai@211 3001 <tr>
fantasai@5976 3002 <td rowspan=8><a href="http://www.w3.org/TR/CSS21/text.html">text
fantasai@5976 3003 properties</a>
fantasai@563 3004
fantasai@563 3005 <td>direction
fantasai@563 3006
fantasai@563 3007 <tr>
fantasai@563 3008 <td>letter-spacing
fantasai@211 3009
fantasai@211 3010 <tr>
fantasai@213 3011 <td>text-align
fantasai@211 3012
fantasai@211 3013 <tr>
fantasai@213 3014 <td>text-decoration
fantasai@211 3015
fantasai@211 3016 <tr>
fantasai@563 3017 <td>text-indent
fantasai@563 3018
fantasai@563 3019 <tr>
fantasai@563 3020 <td>text-transform
fantasai@563 3021
fantasai@563 3022 <tr>
fantasai@563 3023 <td>white-space
fantasai@211 3024
fantasai@211 3025 <tr>
fantasai@213 3026 <td>word-spacing
fantasai@211 3027
fantasai@561 3028 <tbody>
fantasai@211 3029 <tr>
fantasai@213 3030 <td colspan=2><a
fantasai@5976 3031 href="http://www.w3.org/TR/CSS21/visufx.html#visibility">visibility</a>
fantasai@3574 3032
fantasai@3574 3033 <tbody>
fantasai@3574 3034 <tr>
fantasai@3574 3035 <td rowspan=3><a
fantasai@5976 3036 href="http://www.w3.org/TR/CSS21/visudet.html#the-width-property">width</a>
fantasai@5976 3037 <a
fantasai@5976 3038 href="http://www.w3.org/TR/CSS21/visudet.html#min-max-widths">properties</a>
fantasai@3574 3039
fantasai@3574 3040 <td>width
fantasai@3574 3041
fantasai@3574 3042 <tr>
fantasai@3574 3043 <td>min-width
fantasai@3574 3044
fantasai@3574 3045 <tr>
fantasai@3574 3046 <td>max-width
fantasai@114 3047 </table>
fantasai@114 3048
simon@7289 3049 <p>Properties that apply to the page-margin boxes can also be set within
simon@7289 3050 the page context: if inheritable or explicitly inherited (with the
simon@7289 3051 <code>inherit</code> keyword in the margin context), they will inherit
simon@7289 3052 to the page-margin boxes.
fantasai@562 3053
fantasai@1052 3054 <h3 class=no-num id=properties-that-apply-within-the-margin->Properties
fantasai@1052 3055 that apply within the margin contexts</h3>
fantasai@213 3056
fantasai@213 3057 <p>The following CSS 2.1 <a href="#CSS21"
simon@7289 3058 rel=biblioentry>[CSS21]<!--{{!CSS21}}--></a> properties apply to
simon@7289 3059 page-margin boxes. If a conforming user agents supports any of these
simon@7289 3060 properties on block boxes, then it must also support that property for
simon@7289 3061 page-margin boxes (except for <code>z-index</code>, which is optional
simon@7289 3062 for page-margin boxes).
fantasai@114 3063
fantasai@213 3064 <table class=property-list>
fantasai@114 3065 <tbody>
fantasai@114 3066 <tr>
fantasai@5976 3067 <td rowspan=2><a
fantasai@5976 3068 href="http://www.w3.org/TR/CSS21/visuren.html#direction">bidi
fantasai@563 3069 properties</a>
fantasai@563 3070
fantasai@563 3071 <td>direction
fantasai@563 3072
fantasai@563 3073 <tr>
fantasai@563 3074 <td>unicode-bidi
fantasai@563 3075
fantasai@563 3076 <tbody>
fantasai@563 3077 <tr>
fantasai@213 3078 <td rowspan=6><a
fantasai@5976 3079 href="http://www.w3.org/TR/CSS21/colors.html#background-properties">background
fantasai@213 3080 properties</a>
fantasai@213 3081
fantasai@213 3082 <td>background-color
fantasai@114 3083
fantasai@114 3084 <tr>
fantasai@213 3085 <td>background-image
fantasai@114 3086
fantasai@114 3087 <tr>
fantasai@213 3088 <td>background-repeat
fantasai@114 3089
fantasai@114 3090 <tr>
fantasai@213 3091 <td>background-attachment
fantasai@114 3092
fantasai@114 3093 <tr>
fantasai@213 3094 <td>background-position
fantasai@114 3095
fantasai@114 3096 <tr>
fantasai@213 3097 <td>background
fantasai@114 3098
fantasai@561 3099 <tbody>
fantasai@114 3100 <tr>
fantasai@5976 3101 <td rowspan=20><a
fantasai@5976 3102 href="http://www.w3.org/TR/CSS21/box.html#border-properties">border
fantasai@213 3103 properties</a>
fantasai@213 3104
fantasai@213 3105 <td>border-top-width
fantasai@114 3106
fantasai@114 3107 <tr>
fantasai@213 3108 <td>border-right-width
fantasai@114 3109
fantasai@114 3110 <tr>
fantasai@213 3111 <td>border-bottom-width
fantasai@114 3112
fantasai@114 3113 <tr>
fantasai@213 3114 <td>border-left-width
fantasai@114 3115
fantasai@114 3116 <tr>
fantasai@213 3117 <td>border-width
fantasai@114 3118
fantasai@114 3119 <tr>
fantasai@213 3120 <td>border-top-color
fantasai@114 3121
fantasai@114 3122 <tr>
fantasai@213 3123 <td>border-right-color
fantasai@114 3124
fantasai@114 3125 <tr>
fantasai@213 3126 <td>border-bottom-color
fantasai@114 3127
fantasai@114 3128 <tr>
fantasai@213 3129 <td>border-left-color
fantasai@114 3130
fantasai@114 3131 <tr>
fantasai@213 3132 <td>border-color
fantasai@114 3133
fantasai@114 3134 <tr>
fantasai@213 3135 <td>border-top-style
fantasai@114 3136
fantasai@114 3137 <tr>
fantasai@213 3138 <td>border-right-style
fantasai@114 3139
fantasai@114 3140 <tr>
fantasai@213 3141 <td>border-bottom-style
fantasai@114 3142
fantasai@114 3143 <tr>
fantasai@213 3144 <td>border-left-style
fantasai@114 3145
fantasai@114 3146 <tr>
fantasai@213 3147 <td>border-short-style
fantasai@114 3148
fantasai@114 3149 <tr>
fantasai@213 3150 <td>border-top
fantasai@114 3151
fantasai@114 3152 <tr>
fantasai@213 3153 <td>border-right
fantasai@114 3154
fantasai@114 3155 <tr>
fantasai@213 3156 <td>border-bottom
fantasai@114 3157
fantasai@114 3158 <tr>
fantasai@213 3159 <td>border-left
fantasai@114 3160
fantasai@114 3161 <tr>
fantasai@213 3162 <td>border
fantasai@114 3163
fantasai@561 3164 <tbody>
fantasai@114 3165 <tr>
fantasai@5976 3166 <td rowspan=2><a
fantasai@5976 3167 href="http://www.w3.org/TR/CSS21/generate.html#counters">counter
fantasai@563 3168 properties</a>
fantasai@213 3169
fantasai@213 3170 <td>counter-reset
fantasai@114 3171
fantasai@114 3172 <tr>
fantasai@213 3173 <td>counter-increment
fantasai@114 3174
fantasai@561 3175 <tbody>
fantasai@114 3176 <tr>
fantasai@213 3177 <td colspan=2><a href="">content</a>
fantasai@114 3178
fantasai@561 3179 <tbody>
fantasai@114 3180 <tr>
fantasai@5976 3181 <td colspan=2><a
fantasai@5976 3182 href="http://www.w3.org/TR/CSS21/colors.html#propdef-color">color</a>
fantasai@114 3183
fantasai@561 3184 <tbody>
fantasai@114 3185 <tr>
fantasai@5976 3186 <td rowspan=6><a href="http://www.w3.org/TR/CSS21/fonts.html">font
fantasai@5976 3187 properties</a>
fantasai@213 3188
fantasai@213 3189 <td>font-family
fantasai@114 3190
fantasai@114 3191 <tr>
fantasai@563 3192 <td>font-size
fantasai@563 3193
fantasai@563 3194 <tr>
fantasai@213 3195 <td>font-style
fantasai@114 3196
fantasai@114 3197 <tr>
fantasai@213 3198 <td>font-variant
fantasai@114 3199
fantasai@114 3200 <tr>
fantasai@213 3201 <td>font-weight
fantasai@114 3202
fantasai@114 3203 <tr>
fantasai@213 3204 <td>font
fantasai@114 3205
fantasai@561 3206 <tbody>
fantasai@114 3207 <tr>
fantasai@563 3208 <td rowspan=3><a
fantasai@5976 3209 href="http://www.w3.org/TR/CSS21/visudet.html#the-height-property">height</a>
fantasai@5976 3210 <a
fantasai@5976 3211 href="http://www.w3.org/TR/CSS21/visudet.html#min-max-heights">properties</a>
fantasai@563 3212
fantasai@563 3213 <td>height
fantasai@563 3214
fantasai@563 3215 <tr>
fantasai@563 3216 <td>min-height
fantasai@563 3217
fantasai@563 3218 <tr>
fantasai@563 3219 <td>max-height
fantasai@114 3220
fantasai@561 3221 <tbody>
fantasai@114 3222 <tr>
fantasai@213 3223 <td colspan=2><a
fantasai@5976 3224 href="http://www.w3.org/TR/CSS21/visudet.html#line-height">line-height</a>
fantasai@114 3225
fantasai@561 3226 <tbody>
fantasai@114 3227 <tr>
fantasai@5976 3228 <td rowspan=5><a
fantasai@5976 3229 href="http://www.w3.org/TR/CSS21/box.html#margin-properties">margin
fantasai@213 3230 properties</a>
fantasai@213 3231
fantasai@213 3232 <td>margin-top
fantasai@114 3233
fantasai@114 3234 <tr>
fantasai@213 3235 <td>margin-right
fantasai@114 3236
fantasai@114 3237 <tr>
fantasai@213 3238 <td>margin-bottom
fantasai@114 3239
fantasai@114 3240 <tr>
fantasai@213 3241 <td>margin-left
fantasai@114 3242
fantasai@114 3243 <tr>
fantasai@213 3244 <td>margin
fantasai@114 3245
fantasai@561 3246 <tbody>
fantasai@114 3247 <tr>
fantasai@5976 3248 <td rowspan=5><a
fantasai@5976 3249 href="http://www.w3.org/TR/CSS21/ui.html#dynamic-outlines">outline
fantasai@563 3250 properties</a>
fantasai@563 3251
fantasai@563 3252 <td>outline-width
fantasai@563 3253
fantasai@563 3254 <tr>
fantasai@563 3255 <td>outline-style
fantasai@563 3256
fantasai@563 3257 <tr>
fantasai@563 3258 <td>outline-color
fantasai@563 3259
fantasai@563 3260 <tr>
fantasai@563 3261 <td>outline
fantasai@563 3262
fantasai@563 3263 <tbody>
fantasai@563 3264 <tr>
fantasai@563 3265 <td colspan=2><a
fantasai@5976 3266 href="http://www.w3.org/TR/CSS21/visufx.html#overflow">overflow</a>
fantasai@563 3267
fantasai@563 3268 <tbody>
fantasai@563 3269 <tr>
fantasai@5976 3270 <td rowspan=5><a
fantasai@5976 3271 href="http://www.w3.org/TR/CSS21/box.html#padding-properties">padding
fantasai@5976 3272 properties</a>
fantasai@5976 3273
fantasai@5976 3274 <td>padding-top
fantasai@211 3275
fantasai@211 3276 <tr>
fantasai@5976 3277 <td>padding-right
fantasai@211 3278
fantasai@211 3279 <tr>
fantasai@5976 3280 <td>padding-bottom
fantasai@211 3281
fantasai@211 3282 <tr>
fantasai@5976 3283 <td>padding-left
fantasai@563 3284
fantasai@563 3285 <tr>
fantasai@5976 3286 <td>padding
fantasai@211 3287
fantasai@563 3288 <tbody>
fantasai@211 3289 <tr>
fantasai@563 3290 <td colspan=2><a
fantasai@5976 3291 href="http://www.w3.org/TR/CSS21/generate.html#quotes-specify">quotes</a>
fantasai@5976 3292
fantasai@5976 3293 <tbody>
fantasai@5976 3294 <tr>
fantasai@5976 3295 <td rowspan=7><a href="http://www.w3.org/TR/CSS21/text.html">text
fantasai@5976 3296 properties</a>
fantasai@5976 3297
fantasai@5976 3298 <td>letter-spacing
fantasai@5976 3299
fantasai@5976 3300 <tr>
fantasai@5976 3301 <td>text-align
fantasai@5976 3302
fantasai@5976 3303 <tr>
fantasai@5976 3304 <td>text-decoration
fantasai@5976 3305
fantasai@5976 3306 <tr>
fantasai@5976 3307 <td>text-indent
fantasai@5976 3308
fantasai@5976 3309 <tr>
fantasai@5976 3310 <td>text-transform
fantasai@5976 3311
fantasai@5976 3312 <tr>
fantasai@5976 3313 <td>white-space
fantasai@5976 3314
fantasai@5976 3315 <tr>
fantasai@5976 3316 <td>word-spacing
fantasai@211 3317
fantasai@561 3318 <tbody>
fantasai@211 3319 <tr>
fantasai@213 3320 <td colspan=2><a
fantasai@5976 3321 href="http://www.w3.org/TR/CSS21/visudet.html#line-height">vertical-align</a>
fantasai@5976 3322
fantasai@5976 3323 <tbody>
fantasai@5976 3324 <tr>
fantasai@5976 3325 <td colspan=2><a
fantasai@5976 3326 href="http://www.w3.org/TR/CSS21/visufx.html#visibility">visibility</a>
fantasai@211 3327
fantasai@561 3328 <tbody>
fantasai@211 3329 <tr>
fantasai@563 3330 <td rowspan=3><a
fantasai@5976 3331 href="http://www.w3.org/TR/CSS21/visudet.html#the-width-property">width</a>
fantasai@5976 3332 <a
fantasai@5976 3333 href="http://www.w3.org/TR/CSS21/visudet.html#min-max-widths">properties</a>
fantasai@563 3334
fantasai@563 3335 <td>width
fantasai@563 3336
fantasai@563 3337 <tr>
fantasai@563 3338 <td>min-width
fantasai@563 3339
fantasai@563 3340 <tr>
fantasai@563 3341 <td>max-width
fantasai@560 3342
fantasai@561 3343 <tbody>
fantasai@560 3344 <tr>
fantasai@5976 3345 <td colspan=2><a
fantasai@5976 3346 href="http://www.w3.org/TR/CSS21/visuren.html#z-index">z-index</a>
fantasai@114 3347 </table>
fantasai@114 3348
fantasai@552 3349 <h2 class=no-num id=transfer-possibilities>Appendix B: Transfer
fantasai@552 3350 Possibilities</h2>
fantasai@552 3351
fantasai@552 3352 <p>Often, but not always, the page box has a one-to-one correspondence to
fantasai@552 3353 the physical surface onto which the document is ultimately rendered. The
fantasai@552 3354 CSS3 page model specifies formatting within the page box, but it is the
fantasai@552 3355 user agent's responsibility to transfer the page box to the sheet. Some
fantasai@552 3356 user agent transfer possibilities that are not addressed by CSS3
simon@6795 3357 include:
fantasai@552 3358
fantasai@552 3359 <ul id=complex-usecases>
fantasai@552 3360 <li>Transferring one page box to one sheet (e.g. single-sided printing);
fantasai@552 3361
fantasai@552 3362 <li>Transferring two page boxes to the front and back surfaces of the
fantasai@552 3363 same sheet (e.g. double-sided printing);
fantasai@552 3364
fantasai@552 3365 <li>Transferring N (small) page boxes to one sheet (called "N-up");
fantasai@552 3366
fantasai@552 3367 <li>Transferring one (large) page box to N x M sheets (called "tiling");
fantasai@552 3368
fantasai@552 3369 <li>Creating signatures. A <dfn id=signature>signature</dfn> is a group
fantasai@552 3370 of pages printed on a sheet, which, when folded and trimmed like a
fantasai@552 3371 book, appear in their proper sequence;
fantasai@552 3372
fantasai@552 3373 <li>Printing one document to multiple output trays;
fantasai@552 3374
fantasai@552 3375 <li>Generating files containing print instructions.
fantasai@552 3376 </ul>
fantasai@552 3377
fantasai@213 3378 <h2 class=no-num id=references>References</h2>
fantasai@213 3379
fantasai@213 3380 <h3 class=no-num id=normative-references>Normative References</h3>
fantasai@114 3381 <!--begin-normative--> <!-- Sorted by label -->
fantasai@213 3382 <dl class=bibliography>
fantasai@3574 3383 <dt
fantasai@3574 3384 style="display: none"><!-- keeps the doc valid if the DL is empty -->
fantasai@3574 3385 <!---->
fantasai@213 3386
fantasai@213 3387 <dt id=CSS21>[CSS21]
fantasai@114 3388
fantasai@397 3389 <dd>Bert Bos; et al. <a
simon@7289 3390 href="http://www.w3.org/TR/2011/REC-CSS2-20110607/"><cite>Cascading
fantasai@5967 3391 Style Sheets Level 2 Revision 1 (CSS 2.1) Specification.</cite></a> 7
fantasai@5967 3392 June 2011. W3C Recommendation. URL: <a
simon@7289 3393 href="http://www.w3.org/TR/2011/REC-CSS2-20110607/">http://www.w3.org/TR/2011/REC-CSS2-20110607/</a>
simon@6795 3394 </dd>
fantasai@4555 3395 <!---->
fantasai@4555 3396
simon@7430 3397 <dt id=CSS3-BREAK>[CSS3-BREAK]
simon@7430 3398
simon@7430 3399 <dd>Rossen Atanassov; Elika J. Etemad. <a
simon@7430 3400 href="http://www.w3.org/TR/2012/WD-css3-break-20120823/"><cite>CSS
simon@7430 3401 Fragmentation Module Level 3.</cite></a> 23 August 2012. W3C Working
simon@7430 3402 Draft. (Work in progress.) URL: <a
simon@7430 3403 href="http://www.w3.org/TR/2012/WD-css3-break-20120823/">http://www.w3.org/TR/2012/WD-css3-break-20120823/</a>
simon@7430 3404 </dd>
simon@7430 3405 <!---->
simon@7430 3406
fantasai@6061 3407 <dt id=CSS3BG>[CSS3BG]
fantasai@6061 3408
fantasai@6061 3409 <dd>Bert Bos; Elika J. Etemad; Brad Kemper. <a
simon@6795 3410 href="http://www.w3.org/TR/2012/CR-css3-background-20120724/"><cite>CSS
simon@6795 3411 Backgrounds and Borders Module Level 3.</cite></a> 24 July 2012. W3C
fantasai@6061 3412 Candidate Recommendation. (Work in progress.) URL: <a
simon@6795 3413 href="http://www.w3.org/TR/2012/CR-css3-background-20120724/">http://www.w3.org/TR/2012/CR-css3-background-20120724/</a>
simon@6795 3414 </dd>
fantasai@6061 3415 <!---->
fantasai@6061 3416
fantasai@4555 3417 <dt id=MEDIAQ>[MEDIAQ]
fantasai@4555 3418
fantasai@5967 3419 <dd>Florian Rivoal. <a
simon@6795 3420 href="http://www.w3.org/TR/2012/REC-css3-mediaqueries-20120619/"><cite>Media
simon@6795 3421 Queries.</cite></a> 19 June 2012. W3C Recommendation. URL: <a
simon@6795 3422 href="http://www.w3.org/TR/2012/REC-css3-mediaqueries-20120619/">http://www.w3.org/TR/2012/REC-css3-mediaqueries-20120619/</a>
simon@6795 3423 </dd>
fantasai@114 3424 <!---->
fantasai@114 3425
fantasai@213 3426 <dt id=PWGMSN>[PWGMSN]
fantasai@114 3427
fantasai@397 3428 <dd>Ron Bergman; Tom Hastings. <a
fantasai@397 3429 href="ftp://ftp.pwg.org/pub/pwg/candidates/cs-pwgmsn10-20020226-5101.1.pdf"><cite>Media
fantasai@397 3430 Standardized Names.</cite></a> 26 February 2002. IEEE ISTO Printer
fantasai@397 3431 Working Group 5101.1-2002. URL: <a
fantasai@114 3432 href="ftp://ftp.pwg.org/pub/pwg/candidates/cs-pwgmsn10-20020226-5101.1.pdf">ftp://ftp.pwg.org/pub/pwg/candidates/cs-pwgmsn10-20020226-5101.1.pdf</a>
simon@6795 3433 </dd>
fantasai@114 3434 <!---->
fantasai@114 3435
fantasai@213 3436 <dt id=RFC2119>[RFC2119]
fantasai@114 3437
fantasai@397 3438 <dd>S. Bradner. <a href="http://www.ietf.org/rfc/rfc2119.txt"><cite>Key
fantasai@397 3439 words for use in RFCs to Indicate Requirement Levels.</cite></a>
fantasai@397 3440 Internet RFC 2119. URL: <a
fantasai@114 3441 href="http://www.ietf.org/rfc/rfc2119.txt">http://www.ietf.org/rfc/rfc2119.txt</a>
simon@6795 3442 </dd>
fantasai@114 3443 <!---->
fantasai@114 3444 </dl>
fantasai@114 3445 <!--end-normative-->
fantasai@213 3446 <h3 class=no-num id=informative-references>Informative References</h3>
fantasai@114 3447 <!--begin-informative--> <!-- Sorted by label -->
fantasai@213 3448 <dl class=bibliography>
fantasai@3574 3449 <dt
fantasai@3574 3450 style="display: none"><!-- keeps the doc valid if the DL is empty -->
fantasai@3574 3451 <!---->
fantasai@213 3452
simon@7428 3453 <dt id=CSS3-IMAGES>[CSS3-IMAGES]
simon@7428 3454
simon@7428 3455 <dd>Elika J. Etemad; Tab Atkins Jr. <a
simon@7428 3456 href="http://www.w3.org/TR/2012/CR-css3-images-20120417/"><cite>CSS
simon@7428 3457 Image Values and Replaced Content Module Level 3.</cite></a> 17 April
simon@7428 3458 2012. W3C Candidate Recommendation. (Work in progress.) URL: <a
simon@7428 3459 href="http://www.w3.org/TR/2012/CR-css3-images-20120417/">http://www.w3.org/TR/2012/CR-css3-images-20120417/</a>
simon@7428 3460 </dd>
simon@7428 3461 <!---->
simon@7428 3462
fantasai@5975 3463 <dt id=CSS3-WRITING-MODES>[CSS3-WRITING-MODES]
fantasai@5975 3464
fantasai@5975 3465 <dd>Elika J. Etemad; Koji Ishii. <a
simon@7052 3466 href="http://www.w3.org/TR/2012/WD-css3-writing-modes-20121115/"><cite>CSS
simon@7052 3467 Writing Modes Module Level 3.</cite></a> 15 November 2012. W3C Working
simon@7052 3468 Draft. (Work in progress.) URL: <a
simon@7052 3469 href="http://www.w3.org/TR/2012/WD-css3-writing-modes-20121115/">http://www.w3.org/TR/2012/WD-css3-writing-modes-20121115/</a>
simon@6795 3470 </dd>
fantasai@114 3471 <!---->
fantasai@6813 3472
fantasai@6813 3473 <dt id=JLREQ>[JLREQ]
fantasai@6813 3474
fantasai@6813 3475 <dd>Yasuhiro Anan; et al. <a
fantasai@6813 3476 href="http://www.w3.org/TR/2012/NOTE-jlreq-20120403/"><cite>Requirements
fantasai@6813 3477 for Japanese Text Layout.</cite></a> 3 April 2012. W3C Working Group
fantasai@6813 3478 Note. URL: <a
fantasai@6813 3479 href="http://www.w3.org/TR/2012/NOTE-jlreq-20120403/">http://www.w3.org/TR/2012/NOTE-jlreq-20120403/</a>
fantasai@6813 3480 </dd>
fantasai@6813 3481 <!---->
fantasai@114 3482 </dl>
fantasai@114 3483 <!--end-informative--></div>
fantasai@114 3484 </div>

mercurial