1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
<html lang="en">
<HEAD>
<TITLE>Paged media</TITLE>
<link rel="stylesheet" href="style/default.css" type="text/css">
<link rel="stylesheet" href="http://www.w3.org/StyleSheets/TR/W3C-CR.css" type="text/css">
<link rel="prev" href="generate.html">
<link rel="next" href="colors.html">
<link rel="contents" href="cover.html#minitoc">
<link rel="CSS-properties" href="propidx.html" title="properties">
<link rel="index" href="indexlist.html" title="index">
<link rel="first" href="cover.html">
</HEAD>
<body>
<div class="navbar">
<p><a href="generate.html">previous</a>
<a href="colors.html">next</a>
<a href="cover.html#minitoc">contents</a>
<a href="propidx.html">properties</a>
<a href="indexlist.html">index</a>
</div>
<hr class="navbar">
<h1>13 <a name="the-page">Paged media</a></h1>
<div class="subtoc">
<p><strong>Contents</strong>
<ul class="toc">
<li class="tocline2"><a href="page.html#page-intro" class="tocxref">13.1 Introduction to paged media</a>
<li class="tocline2"><a href="page.html#page-box" class="tocxref">13.2 Page boxes: the @page rule</a>
<ul class="toc">
<li class="tocline3"><a href="page.html#page-margins" class="tocxref">13.2.1 Page margins</a>
<li class="tocline3"><a href="page.html#page-selectors" class="tocxref">13.2.2 Page selectors: selecting left, right, and first pages</a>
<li class="tocline3"><a href="page.html#outside-page-box" class="tocxref">13.2.3 Content outside the page box</a>
</ul>
<li class="tocline2"><a href="page.html#page-breaks" class="tocxref">13.3 Page breaks</a>
<ul class="toc">
<li class="tocline3"><a href="page.html#page-break-props" class="tocxref">13.3.1 Page break properties: <span class="propinst-page-break-before">'page-break-before'</span>, <span class="propinst-page-break-after">'page-break-after'</span>, <span class="propinst-page-break-inside">'page-break-inside'</span></a>
<li class="tocline3"><a href="page.html#break-inside" class="tocxref">13.3.2 Breaks inside elements: <span class="propinst-orphans">'orphans'</span>, <span class="propinst-widows">'widows'</span></a>
<li class="tocline3"><a href="page.html#allowed-page-breaks" class="tocxref">13.3.3 Allowed page breaks</a>
<li class="tocline3"><a href="page.html#forced" class="tocxref">13.3.4 Forced page breaks</a>
<li class="tocline3"><a href="page.html#best-page-breaks" class="tocxref">13.3.5 "Best" page breaks</a>
</ul>
<li class="tocline2"><a href="page.html#page-cascade" class="tocxref">13.4 Cascading in the page context</a>
</ul>
</div>
<h2>13.1 <a name="page-intro">Introduction to paged media</a></h2>
<p>Paged media (e.g., paper, transparencies, pages that are displayed
on computer screens, etc.) differ from <a
href="media.html#continuous-media-group">continuous media</a> in
that the content of the document is split into one or more discrete
pages. To handle pages, CSS 2.1 describes how page margins are set
on <a href="page.html#page-box">page boxes</a>, and how <a href="page.html#page-breaks">page breaks</a> are declared.
<p>The user agent is responsible for transferring the page boxes of a
document onto the real <a name="x0"><span class="index-def"
title="sheet"><dfn>sheets</dfn></span></a> where the document will
ultimately be rendered (paper, transparency, screen, etc.). There is
often a 1-to-1 relationship between a page box and a sheet, but this
is not always the case. Transfer possibilities include:</P>
<ul>
<li>Transferring one page box to one sheet (e.g., single-sided printing).
<li>Transferring two page boxes to both sides of the same sheet (e.g.,
double-sided printing).
<li>Transferring N (small) page boxes to one sheet (called "n-up").
<li>Transferring one (large) page box to N x M sheets (called "tiling").
<li>Creating signatures. A signature is a group of pages
printed on a sheet, which, when folded and trimmed like a book, appear in their
proper sequence.
<li>Printing one document to several output trays.
<li>Outputting to a file.
</ul>
<h2>13.2 <a name="page-box">Page boxes</a>: the @page rule</h2>
<p>The <a name="x1"><span class="index-def" title="page box"><dfn>page
box</dfn></span></a> is a rectangular region that contains two areas:</p>
<ul>
<li>The <span class="index-def" title="page area"><a
name="page-area"><dfn>page area</dfn></a></span>. The page area
includes the boxes laid out on that page. The edges of the first page
area establish the rectangle that is the initial <a
href="visudet.html#containing-block-details">containing block</a> of
the document.
The canvas background is painted within and covers the page area.
<li>The margin area, which surrounds the page area.
The page margin area is transparent.
</ul>
<p>The size of a page box cannot be specified in CSS 2.1.
<P>Authors can specify the margins of a page box inside an <a name="x3"><span
class="index-def" title="@page">@page</span></a> rule. An @page rule
consists of the keyword "@page", followed by an optional page
selector, followed by a block of declarations. The declarations in an
@page rule are said to be in the <span class="index-def"
title="page-context"><a name="page-context"><dfn>page
context</dfn></a></span>.</p>
<P>The <a name="x5"><span class="index-def" title="page selector"><dfn>page
selector</dfn></span></a> specifies for which pages the declarations
apply. In CSS 2.1, page selectors may designate the first page,
all left pages, or all right pages</p>
<h3>13.2.1 <a name="page-margins">Page margins</a></h3>
<P>In CSS 2.1, only the <a href="box.html#margin-properties">margin
properties</a> (<a href="box.html#propdef-margin-top" class="noxref"><span class="propinst-margin-top">'margin-top'</span></a>,
<a href="box.html#propdef-margin-right" class="noxref"><span class="propinst-margin-right">'margin-right'</span></a>, <a href="box.html#propdef-margin-bottom" class="noxref"><span
class="propinst-margin-bottom">'margin-bottom'</span></a>, <a href="box.html#propdef-margin-left" class="noxref"><span
class="propinst-margin-left">'margin-left'</span></a>, and <a href="box.html#propdef-margin" class="noxref"><span
class="propinst-margin">'margin'</span></a>) apply within the <a
href="page.html#page-context">page context</a>. The following diagram shows the
relationships between the sheet, page box, and page margins:</P>
<div class="figure">
<P><img src="images/page-info.png" alt="Illustration of sheet, page
box, margin, and page area."><SPAN class="dlink"> <A name="img-page-info" href="images/longdesc/page-info-desc.html" title="Long description illustrating relationship between page box
and sheet">[D]</A></SPAN></p>
</div>
<div class="example"><P style="display:none">Example(s):</P><P>
Here is a simple example which sets all page margins on all pages:
<pre>
@page {
margin: 3cm;
}
</pre>
</div>
<p>The <a href="page.html#page-context">page context</a> has no notion of
fonts, so 'em' and 'ex' units are not allowed. Percentage values on
the margin properties are relative to the dimensions of the <a
href="page.html#page-box">page box</a>; for left and right margins, they refer
to the width of the page box while for top and bottom margins, they
refer to the height of the page box. All other units associated with
the respective CSS 2.1 properties are allowed.
<P>Due to negative margin values (either on the page box or on
elements) or <a href="visuren.html#absolute-positioning">absolute
positioning</a> content may end up outside the page box, but this
content may be "cut" — by the user agent, the printer, or ultimately,
the paper cutter.
<h3>13.2.2 <a name="page-selectors">Page selectors: selecting left, right, and first pages</a></H3>
<P>When printing double-sided documents, the <a href="page.html#page-box">page
boxes</a> on left and right pages may be different. This can be
expressed through two CSS pseudo-classes that may be used in page selectors.
<P>All pages are automatically classified by user agents into either
the <a name="x6"><span class="index-def"
title=":left|pseudo-class:::left">:left</span></a> or <a name="x8"><span
class="index-def" title=":right|pseudo-class:::right">:right</span></a>
pseudo-class.
<div class="example"><P style="display:none">Example(s):</P><P>
<PRE>
@page :left {
margin-left: 4cm;
margin-right: 3cm;
}
@page :right {
margin-left: 3cm;
margin-right: 4cm;
}
</PRE>
</div>
<p>If different declarations have been given for left and right pages,
the user agent must honor these declarations even if the user agent
does not transfer the page boxes to left and right sheets (e.g., a
printer that only prints single-sided).
<P>Authors may also specify style for the first page of a document
with the <a name="x10"><span class="index-def"
title=":first|pseudo-class:::first">:first</span></a> pseudo-class:
<div class="example"><P style="display:none">Example(s):</P><P>
<PRE>
@page { margin: 2cm } /* All margins set to 2cm */
@page :first {
margin-top: 10cm /* Top margin on first page 10cm */
}
</PRE>
</div>
<P>Properties specified in a :left or :right @page rule override
those specified in an @page rule that has no pseudo-class specified.
Properties specified in a :first @page rule override those specified
in :left or :right @page rules.
<P>Margin declarations on left, right, and first pages may result in
different <a href="page.html#page-area">page area</a> widths. To simplify
implementations, user agents may use a single page area width
on left, right, and first pages. In this case, the page area width
of the first page should be used.
<h3>13.2.3 <a name="outside-page-box">Content outside the page box</a></h3>
<P>When formatting content in the page model, some content may end up
outside the current page box. For example, an element whose <a href="text.html#propdef-white-space" class="noxref"><span
class="propinst-white-space">'white-space'</span></a> property has the
value 'pre' may generate a box that is wider than the page box. As
another example, when boxes are positioned absolutely or relatively,
they may end up in "inconvenient" locations. For example, images may
be placed on the edge of the page box or 100,000 meters below the page
box.
<P>The exact formatting of such elements lies outside the scope of
this specification. However, we recommend that authors and user agents
observe the following general principles concerning content outside
the page box:</p>
<ul>
<li>Content should be allowed slightly beyond the page box to allow
pages to "bleed".
<li>User agents should avoid generating a large number of empty page
boxes to honor the positioning of elements (e.g., you don't want to
print 100 blank pages).
<li>Authors should not position elements in inconvenient locations
just to avoid rendering them.
<li>User agents may handle boxes positioned outside the page box in
several ways, including discarding them or creating page boxes for
them at the end of the document.
</ul>
<H2>13.3 <a name="page-breaks">Page breaks</a></H2>
<P>This section describes page breaks in CSS 2.1. Five
properties indicate where the user agent may or should break pages,
and on what page (left or right) the subsequent content should resume.
Each page break ends layout in the current <a href="page.html#page-box">page
box</a> and causes remaining pieces of the <a
href="conform.html#doctree">document tree</a> to be laid out in a new
page box.
<h3>13.3.1 <a name="page-break-props">Page break properties</a>: <a href="page.html#propdef-page-break-before" class="noxref"><span
class="propinst-page-break-before">'page-break-before'</span></a>,
<a href="page.html#propdef-page-break-after" class="noxref"><span class="propinst-page-break-after">'page-break-after'</span></a>,
<a href="page.html#propdef-page-break-inside" class="noxref"><span class="propinst-page-break-inside">'page-break-inside'</span></a>
</h3>
<div class="propdef">
<dl><dt>
<span class="index-def" title="'page-break-before'"><a name="propdef-page-break-before" class="propdef-title"><strong>'page-break-before'</strong></a></span>
<dd>
<table class="propinfo" cellspacing=0 cellpadding=0>
<tr valign=baseline><td><em>Value:</em> <td>auto | always | avoid | left | right | <a href="cascade.html#value-def-inherit" class="noxref"><span class="value-inst-inherit">inherit</span></a>
<tr valign=baseline><td><em>Initial:</em> <td>auto
<tr valign=baseline><td><em>Applies to:</em> <td>block-level elements (but see text)
<tr valign=baseline><td><em>Inherited:</em> <td>no
<tr valign=baseline><td><em>Percentages:</em> <td>N/A
<tr valign=baseline><td><em>Media:</em> <td><a href="media.html#visual-media-group" class="noxref">visual</a>, <a href="media.html#paged-media-group" class="noxref">paged</a>
<tr valign=baseline><td><em>Computed value:</em> <td>as specified
</table>
</dl>
</div>
<div class="propdef">
<dl><dt>
<span class="index-def" title="'page-break-after'"><a name="propdef-page-break-after" class="propdef-title"><strong>'page-break-after'</strong></a></span>
<dd>
<table class="propinfo" cellspacing=0 cellpadding=0>
<tr valign=baseline><td><em>Value:</em> <td>auto | always | avoid | left | right | <a href="cascade.html#value-def-inherit" class="noxref"><span class="value-inst-inherit">inherit</span></a>
<tr valign=baseline><td><em>Initial:</em> <td>auto
<tr valign=baseline><td><em>Applies to:</em> <td>block-level elements (but see text)
<tr valign=baseline><td><em>Inherited:</em> <td>no
<tr valign=baseline><td><em>Percentages:</em> <td>N/A
<tr valign=baseline><td><em>Media:</em> <td><a href="media.html#visual-media-group" class="noxref">visual</a>, <a href="media.html#paged-media-group" class="noxref">paged</a>
<tr valign=baseline><td><em>Computed value:</em> <td>as specified
</table>
</dl>
</div>
<div class="propdef">
<dl><dt>
<span class="index-def" title="'page-break-inside'"><a name="propdef-page-break-inside" class="propdef-title"><strong>'page-break-inside'</strong></a></span>
<dd>
<table class="propinfo" cellspacing=0 cellpadding=0>
<tr valign=baseline><td><em>Value:</em> <td>avoid | auto | <a href="cascade.html#value-def-inherit" class="noxref"><span class="value-inst-inherit">inherit</span></a>
<tr valign=baseline><td><em>Initial:</em> <td>auto
<tr valign=baseline><td><em>Applies to:</em> <td>block-level elements (but see text)
<tr valign=baseline><td><em>Inherited:</em> <td>no
<tr valign=baseline><td><em>Percentages:</em> <td>N/A
<tr valign=baseline><td><em>Media:</em> <td><a href="media.html#visual-media-group" class="noxref">visual</a>, <a href="media.html#paged-media-group" class="noxref">paged</a>
<tr valign=baseline><td><em>Computed value:</em> <td>as specified
</table>
</dl>
</div>
<P>Values for these properties have the following meanings:</p>
<dl>
<dt><strong>auto</strong></dt>
<dd>Neither force nor forbid a page break before (after, inside) the
generated box.
<dt><strong>always</strong></dt>
<dd>Always force a page break before (after) the
generated box.</dd>
<dt><strong>avoid</strong></dt>
<dd>Avoid a page break before (after, inside) the generated box.
<dt><strong>left</strong></dt>
<dd>
Force one or two page breaks before
(after) the generated box
so that the next page is formatted as a left page.</dd>
<dt><strong>right</strong></dt>
<dd>
Force one or two page breaks before (after) the generated
box so that the next page is formatted as a right page.</dd>
</dl>
<p>Whether the first page of a document is :left or :right depends on
the major writing direction of the document. A conforming user agent
may interpret the values 'left' and 'right' as 'always'.
<p>A potential page break location is typically under the influence
of the parent element's <a href="page.html#propdef-page-break-inside" class="noxref"><span
class="propinst-page-break-inside">'page-break-inside'</span></a>
property, the <a href="page.html#propdef-page-break-after" class="noxref"><span
class="propinst-page-break-after">'page-break-after'</span></a> property
of the preceding element, and the <a href="page.html#propdef-page-break-before" class="noxref"><span
class="propinst-page-break-before">'page-break-before'</span></a> property
of the following element. When these properties have values other
than 'auto', the values 'always', 'left', and 'right' take precedence
over 'avoid'.
<p>User Agents must apply these properties to block-level elements
in the normal flow of the root element. User agents may also apply
these properties to other elements, e.g., 'table-row' elements.
<p>When a page break splits a box, the box's margins, borders, and
padding have no visual effect where the split occurs.
<h3>13.3.2 <a name="break-inside">Breaks inside elements</a>: <a href="page.html#propdef-orphans" class="noxref"><span
class="propinst-orphans">'orphans'</span></a>, <a href="page.html#propdef-widows" class="noxref"><span
class="propinst-widows">'widows'</span></a></h3>
<div class="propdef">
<dl><dt>
<span class="index-def" title="'orphans'"><a name="propdef-orphans" class="propdef-title"><strong>'orphans'</strong></a></span>
<dd>
<table class="propinfo" cellspacing=0 cellpadding=0>
<tr valign=baseline><td><em>Value:</em> <td><a href="syndata.html#value-def-integer" class="noxref"><span class="value-inst-integer"><integer></span></a> | <a href="cascade.html#value-def-inherit" class="noxref"><span class="value-inst-inherit">inherit</span></a>
<tr valign=baseline><td><em>Initial:</em> <td>2
<tr valign=baseline><td><em>Applies to:</em> <td>block-level elements
<tr valign=baseline><td><em>Inherited:</em> <td>yes
<tr valign=baseline><td><em>Percentages:</em> <td>N/A
<tr valign=baseline><td><em>Media:</em> <td><a href="media.html#visual-media-group" class="noxref">visual</a>, <a href="media.html#paged-media-group" class="noxref">paged</a>
<tr valign=baseline><td><em>Computed value:</em> <td>as specified
</table>
</dl>
</div>
<div class="propdef">
<dl><dt>
<span class="index-def" title="'widows'"><a name="propdef-widows" class="propdef-title"><strong>'widows'</strong></a></span>
<dd>
<table class="propinfo" cellspacing=0 cellpadding=0>
<tr valign=baseline><td><em>Value:</em> <td><a href="syndata.html#value-def-integer" class="noxref"><span class="value-inst-integer"><integer></span></a> | <a href="cascade.html#value-def-inherit" class="noxref"><span class="value-inst-inherit">inherit</span></a>
<tr valign=baseline><td><em>Initial:</em> <td>2
<tr valign=baseline><td><em>Applies to:</em> <td>block-level elements
<tr valign=baseline><td><em>Inherited:</em> <td>yes
<tr valign=baseline><td><em>Percentages:</em> <td>N/A
<tr valign=baseline><td><em>Media:</em> <td><a href="media.html#visual-media-group" class="noxref">visual</a>, <a href="media.html#paged-media-group" class="noxref">paged</a>
<tr valign=baseline><td><em>Computed value:</em> <td>as specified
</table>
</dl>
</div>
<P>The <a href="page.html#propdef-orphans" class="noxref"><span class="propinst-orphans">'orphans'</span></a> property
specifies the minimum number of lines in a block element that must be left
at the bottom of a page. The <a href="page.html#propdef-widows" class="noxref"><span class="propinst-widows">'widows'</span></a> property specifies the minimum
number of lines in a block element that must be left at the top of a page.
Examples of how they are used to control page breaks are given below.
<p>Only positive values are allowed.
<P>For information about paragraph formatting, please consult the
section on <a href="visuren.html#line-box">line boxes</a>.
<h3>13.3.3 <a name="allowed-page-breaks">Allowed page breaks</a></h3>
<p>In the normal flow, page breaks can occur at the following places:</p>
<ol>
<li>
In the vertical margin between block boxes. When an unforced page
break occurs here, the <a href="cascade.html#used-value">used
values</a> of the relevant <a href="box.html#propdef-margin-top" class="noxref"><span
class="propinst-margin-top">'margin-top'</span></a> and <a href="box.html#propdef-margin-bottom" class="noxref"><span
class="propinst-margin-bottom">'margin-bottom'</span></a> properties are
set to '0'. When a forced page break occurs here, the used value of
the relevant <a href="box.html#propdef-margin-bottom" class="noxref"><span
class="propinst-margin-bottom">'margin-bottom'</span></a> property is set
to '0'; the relevant <a href="box.html#propdef-margin-top" class="noxref"><span
class="propinst-margin-top">'margin-top'</span></a> used value may either
be set to '0' or retained.
<li>Between <a href="visuren.html#line-box">line boxes</a>
inside a <a href="visuren.html#block-box">block</a> box.
</ol>
<p class=note>Note: It is expected that CSS3 will specify that the
relevant 'margin-top' applies (i.e., is not set to '0') after a forced
page break.
<p>These breaks are subject to the following rules:
<ul>
<li><strong>Rule A:</strong> Breaking at (1) is allowed only if the <a href="page.html#propdef-page-break-after" class="noxref"><span
class="propinst-page-break-after">'page-break-after'</span></a> and <a href="page.html#propdef-page-break-before" class="noxref"><span
class="propinst-page-break-before">'page-break-before'</span></a> properties of all
the elements generating boxes that
meet at this margin allow it, which is when at least
one of them has the value 'always', 'left', or 'right', or when all of them are
'auto'.
<li><strong>Rule B:</strong> However, if all of them are 'auto' and
a common ancestor of all the elements has a <a href="page.html#propdef-page-break-inside" class="noxref"><span
class="propinst-page-break-inside">'page-break-inside'</span></a> value of
'avoid', then breaking here is not allowed.
<li>
<strong>Rule C:</strong> Breaking at (2) is allowed only if the number of <a
href="visuren.html#line-box">line boxes</a> between the
break and the start of the enclosing block box is
the value of <a href="page.html#propdef-orphans" class="noxref"><span
class="propinst-orphans">'orphans'</span></a> or more, and the number of
line boxes between the break and the end of the box is
the value of <a href="page.html#propdef-widows" class="noxref"><span class="propinst-widows">'widows'</span></a> or more.
<li><strong>Rule D:</strong> In addition, breaking at (2) is allowed only if the <a href="page.html#propdef-page-break-inside" class="noxref"><span
class="propinst-page-break-inside">'page-break-inside'</span></a> property
of the element and all its ancestors is 'auto'.
</ul>
<p>If the above doesn't provide enough break points to keep content
from overflowing the page boxes, then rules A, B and D are dropped in
order to find additional breakpoints.
<p>If that still does not lead to sufficient break points, rule
C is dropped as well, to find still more break points.
<h3>13.3.4 <a name="forced">Forced page breaks</a></h3>
<p>A page break <em>must</em> occur at (1) if, among the <a href="page.html#propdef-page-break-after" class="noxref"><span
class="propinst-page-break-after">'page-break-after'</span></a> and <a href="page.html#propdef-page-break-before" class="noxref"><span
class="propinst-page-break-before">'page-break-before'</span></a>
properties of all the elements generating boxes that meet at this
margin, there is at least one with the value 'always', 'left', or
'right'.
<h3>13.3.5 <a name="best-page-breaks">"Best" page breaks</a></h3>
<p>CSS 2.1 does <em>not</em> define which of a set of allowed page breaks
must be used; CSS 2.1 does not forbid a user agent from breaking at every
possible break point, or not to break at all. But CSS 2.1 does recommend
that user agents observe the following heuristics (while recognizing
that they are sometimes contradictory):</p>
<ul>
<li>Break as few times as possible.
<li>Make all pages that don't end with a forced break appear to have about
the same height.
<li>Avoid breaking inside a replaced element.
</ul>
<div class="example"><P style="display:none">Example(s):</P><P>
Suppose, for example, that the style sheet
contains 'orphans: 4', 'widows: 2', and
there are 20 lines (<a href="visuren.html#line-box">line boxes</a>)
available at the bottom of the current page:</p>
<ul>
<li>If a paragraph at the end of the current page contains 20 lines or fewer,
it should be placed on the current page.
<li>If the paragraph contains 21 or 22 lines, the second part of the
paragraph must not violate the <a href="page.html#propdef-widows" class="noxref"><span
class="propinst-widows">'widows'</span></a> constraint, and so the
second part must contain exactly two lines
<li>If the paragraph contains 23 lines or more, the first part should
contain 20 lines and the second part the remaining lines.
</ul>
<P>Now suppose that <a href="page.html#propdef-orphans" class="noxref"><span class="propinst-orphans">'orphans'</span></a> is
'10',
<a href="page.html#propdef-widows" class="noxref"><span class="propinst-widows">'widows'</span></a> is '20',
and there are 8 lines available at the bottom of the current page:</p>
<ul>
<li>If a paragraph at the end of the current page contains 8 lines or
fewer, it should be placed on the current page.
<li>If the paragraph contains 9 lines or more, it cannot be split
(that would violate the orphan constraint), so it should move
as a block to the next page.
</ul>
</div>
<h2>13.4 <a name="page-cascade">Cascading in the page context</a></H2>
<P>Declarations in the <a href="page.html#page-context">page context</a> obey
the <a href="cascade.html">cascade</a> just like normal CSS
declarations.
<div class="example"><P style="display:none">Example(s):</P><P>
Consider the following example:
<PRE>
@page {
margin-left: 3cm;
}
@page :left {
margin-left: 4cm;
}
</PRE>
<P>Due to the <a href="cascade.html#cascading-order">higher
specificity</a> of the pseudo-class selector, the left margin on left
pages will be '4cm' and all other pages (i.e., the right pages) will
have a left margin of '3cm'.
</div>
<hr class="navbar">
<div class="navbar">
<p><a href="generate.html">previous</a>
<a href="colors.html">next</a>
<a href="cover.html#minitoc">contents</a>
<a href="propidx.html">properties</a>
<a href="indexlist.html">index</a>
</div>
</body>
</html>
|