forked from w3c/csswg-drafts
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpage.html
More file actions
608 lines (491 loc) · 39.2 KB
/
page.html
File metadata and controls
608 lines (491 loc) · 39.2 KB
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
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
<!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-ED.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 <del>size: the 'size' property Rendering page boxes that do not fit a target sheet Positioning the page box on the sheet 13.2.3 Crop marks: the 'marks' property 13.2.4</del><ins>selectors: selecting</ins> left, right, and first pages</a>
<li class="tocline3"><a href="page.html#outside-page-box" class="tocxref"> <del>13.2.5</del><ins>13.2.3</ins> 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 <ins>Page</ins> break <del>before/after elements:</del><ins>properties:</ins> <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 <del>Using named pages: 'page' 13.3.3</del>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"> <del>13.3.4</del><ins>13.3.3</ins> Allowed page breaks</a>
<li class="tocline3"><a href="page.html#forced" class="tocxref"> <del>13.3.5</del><ins>13.3.4</ins> Forced page breaks</a>
<li class="tocline3"><a href="page.html#best-page-breaks" class="tocxref"> <del>13.3.6</del><ins>13.3.5</ins> "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 <ins>pages, CSS 2.1 describes how</ins> page <del>breaks, CSS2 extends the visual formatting model as follows: The</del><ins>margins are set
on</ins> <a href="#page-box">page <del>box extends the box model to allow authors to specify the size of a page, its margins, etc. The</del><ins>boxes</ins></a><ins>, and how</ins> <a href="#page-breaks">page <del>model extends</del><ins>breaks</ins></a> <ins>are declared.</ins>
<p>The <del>visual formatting model to account</del><ins>user agent is responsible</ins> for <del>page breaks.</del><ins>transferring</ins> the <del>CSS2</del>page <del>model specifies how</del><ins>boxes of</ins> a
document <del>is formatted within a rectangular area -- the page box -- that has a finite width and height. The page box does not necessarily correspond to</del><ins>onto</ins> the real <a name="x0"><span class="index-def"
title="sheet"><dfn> <del>sheet</del><ins>sheets</ins></dfn></span></a> where the document will
ultimately be rendered (paper, transparency, screen, etc.). <del>The CSS page model specifies formatting in the page box, but it</del><ins>There</ins> is
<del>the user agent's responsibility to transfer the</del><ins>often a 1-to-1 relationship between a</ins> page box <del>to</del><ins>and a sheet, but this
is not always</ins> the <del>sheet. Some</del><ins>case.</ins> 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> <del>Although CSS2 does not specify how user agents transfer page boxes to sheets, it does include certain mechanisms for telling user agents about the target sheet size and orientation .</del>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 <ins>first</ins> page
area <del>act as</del><ins>establish the rectangle that is</ins> the initial <a
href="visudet.html#containing-block-details">containing block</a> <del>for layout that occurs between</del><ins>of
the document.
The canvas background is painted within and covers the</ins> page <del>breaks.</del><ins>area.</ins>
<li>The margin area, which surrounds the page area.
<del>Note. In CSS2,</del>The <del>border properties and padding properties do not apply to pages; they may in</del><ins>page margin area is transparent.</ins>
</ul>
<p>The <del>future.</del><ins>size of a page box cannot be specified in CSS 2.1.</ins>
<P>Authors <ins>can</ins> specify the <del>dimensions, orientation, margins, etc.</del><ins>margins</ins> of a page box <del>within</del><ins>inside</ins> an <a name="x3"><span
class="index-def" title="@page">@page</span></a> rule. An @page rule
consists of the keyword "@page", <del>a page selector (followed with no intervening space</del><ins>followed</ins> by an optional page
<del>pseudo-class), and</del><ins>selector, followed by</ins> a block <del>of</del><ins>containing declarations and
at-rules. Comments and white space are allowed, but optional, between
the @page token and the page selector and between the page selector
and the block. The</ins> declarations <del>(said</del><ins>in an
@page rule are said</ins> to be in the <span class="index-def"
title="page-context"><a name="page-context"><dfn>page
context</dfn></a></span> <del>).</del><ins>.</ins></p>
<p class=note><ins>Note: CSS level 2 has no at-rules that may appear
inside @page, but such at-rules are expected to be defined in
level 3.</ins>
<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 <del>CSS2,</del><ins>CSS 2.1,</ins> page selectors may designate the first page,
all left pages, <ins>or</ins> all right <del>pages, or a page with a specific name. The dimensions of</del><ins>pages</ins></p>
<P>The <del>page box</del><ins>rules for handling malformed declarations, malformed
statements, and invalid at-rules inside @page</ins> are <del>set</del><ins>as defined in</ins> <a
href="syndata.html#parsing-errors"><ins>section 4.2,</ins></a> with the
<del>'size' property. The dimensions of</del><ins>following addition: when</ins> the <del>page area are</del><ins>UA expects</ins> the <del>dimensions</del><ins>start</ins> of <del>the page box minus the margin area. Example(s): For example, the following @page rule sets the page box size</del><ins>a declaration or
at-rule (i.e., an IDENT token or an ATKEYWORD token) but finds an
unexpected token instead, that token is considered</ins> to <del>8.5 x 11 inches and creates '2cm' margin on all sides between the page box edge and</del><ins>be</ins> the <del>page area: @page { size 8.5in 11in; margin: 2cm }</del><ins>first
token of a malformed declaration. I.e.,</ins> the <del>'marks' property in an @page</del>rule <del>specifies crop and cross marks</del>for <del>the page box.</del><ins>malformed
declarations, rather than malformed statements is used to determine
which tokens to ignore in that case.</ins>
<h3>13.2.1 <a name="page-margins">Page margins</a></h3>
<P><ins>In CSS 2.1, only</ins> 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-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"> <del>The computed value of box margins at the top or bottom of the page area</del><ins>Example(s):</ins></P><P>
<ins>Here</ins> is <del>'0'.</del><ins>a simple example which sets all page margins on all pages:</ins>
<pre>
<ins>@page {
margin: 3cm;
}</ins>
</pre>
</div>
<p>The <a href="#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-box">page box</a>; for left and <del>right margins, they refer to page box width while for top and bottom margins, they refer to page box height. All other units associated with the respective CSS2 properties are allowed. Due to negative margin values (either on the page box or on elements) or absolute positioning 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. 13.2.2 Page size : the 'size' property 'size' Value: <length> {1,2} | auto | portrait | landscape | inherit Initial: auto Applies to: the page context Inherited: N/A Percentages: N/A Media: visual , paged This property specifies the size and orientation of a page box. The size of a page box may either be "absolute" (fixed size) or "relative" (scalable, i.e., fitting available sheet sizes). Relative page boxes allow user agents to scale a document and make optimal use of the target size. Three values for the 'size' property create a relative page box: auto The page box will be set to the size and orientation of the target sheet. landscape Overrides the target's orientation. The page box is the same size as the target, and the longer sides are horizontal. portrait Overrides the target's orientation. The page box is the same size as the target, and the shorter sides are horizontal. Example(s): In the following example, the outer edges of the page box will align with the target. The percentage value on the 'margin' property is relative to the target size so if the target sheet dimensions are 21.0cm x 29.7cm (i.e., A4), the margins are 2.10cm and 2.97cm. @page { size: auto; /* auto is the initial value */ margin: 10%; } Length values for the 'size' property create an absolute page box. If only one length value is specified, it sets both the width and height of the page box (i.e., the box is a square). Since the page box is the initial containing block , percentage values are not allowed for the 'size' property. Example(s): For example: @page { size: 8.5in 11in; /* width height */ } The above example set the width of the page box to be 8.5in and the height to be 11in. The page box in this example requires a target sheet size of 8.5"x11" or larger. User agents may allow users to control the transfer of the page box to the sheet (e.g., rotating an absolute page box that's being printed). Rendering page boxes that do not fit a target sheet If a page box does not fit the target sheet dimensions, the user agent may choose to: Rotate the page box 90° if this will make the page box fit. Scale the page to fit the target. The user agent should consult the user before performing these operations. Positioning the page box on the sheet When the page box is smaller than the target size, the user agent is free to place the page box anywhere on the sheet. However, it is recommended that the page box be centered on the sheet since this will align double-sided pages and avoid accidental loss of information that is printed near the edge of the sheet. 13.2.3 Crop marks : the 'marks' property 'marks' Value: [ crop || cross ] | none | inherit Initial: none Applies to: page context Inherited: N/A Percentages: N/A Media: visual , paged In high-quality printing, marks are often added outside</del><ins>right margins, they refer
to</ins> the <del>page box. This property specifies whether cross marks or crop marks or both should be rendered just outside</del><ins>width of</ins> the page box <del>edge. Crop marks indicate where</del><ins>while for top and bottom margins, they
refer to the height of</ins> the page <del>should be cut. Cross marks (also known as register marks or registration marks)</del><ins>box. All other units associated with
the respective CSS 2.1 properties</ins> are <del>used</del><ins>allowed.</ins>
<P><ins>Due</ins> to <del>align sheets. Marks are visible only</del><ins>negative margin values (either</ins> on <del>absolute page boxes (see the 'size' property). In relative page boxes,</del>the page box <del>will be aligned with the target and</del><ins>or on
elements) or</ins> <a href="visuren.html#absolute-positioning"><ins>absolute
positioning</ins></a> <ins>content may end up outside</ins> the <del>marks will</del><ins>page box, but this
content may</ins> be <del>outside</del><ins>"cut" — by</ins> the <del>printable area.</del><ins>user agent,</ins> the <del>size, style, and position of cross marks depend on</del><ins>printer, or ultimately,</ins>
the <del>user agent. 13.2.4</del><ins>paper cutter.</ins>
<h3><ins>13.2.2</ins> <a name="page-selectors"><ins>Page selectors: selecting</ins> left, right, and first pages</a></H3>
<P>When printing double-sided documents, the <a href="#page-box">page
boxes</a> on left and right pages <del>should</del><ins>may</ins> be different. This can be
expressed through two CSS pseudo-classes that may be <del>defined</del><ins>used</ins> in <del>the</del>page <del>context .</del><ins>selectors.</ins>
<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.
<ins>Whether the first page of a document is :left or :right depends on the
major writing direction of the root element. For example, the first
page of a document with a left-to-right major writing direction would
be a :right page, and the first page of a document with a
right-to-left major writing direction would be a :left page. To
explicitly force a document to begin printing on a left or right page,
authors can</ins> <a href="#page-break-props"><ins>insert a page break</ins></a> <ins>before
the first generated box.</ins>
<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> <del>Whether the first page of a document is :left or :right depends on the major writing direction of the document and is outside the scope of this document. However, to force a :left or :right first page, authors may insert a page break before the first generated box (e.g., in HTML, specify this for the BODY element).</del>Properties specified in a :left <del>(or :right)</del><ins>or :right</ins> @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 <del>(or :right)</del><ins>or :right</ins> @page rules.
<p> <del>Note. Adding declarations to</del><ins>If a</ins> <a href="#forced"><ins>forced break</ins></a> <ins>occurs before</ins> the <del>:left or :right pseudo-class does not influence</del><ins>first
generated box, it is undefined in CSS 2.1</ins> whether <ins>':first'
applies to</ins> the <del>document comes out of</del><ins>blank page before</ins> the <del>printer double-</del><ins>break</ins> or <del>single-sided (which is outside</del><ins>to</ins> the <del>scope of</del><ins>page after it.</ins>
<P><ins>Margin declarations on left, right, and first pages may result in
different</ins> <a href="#page-area"><ins>page area</ins></a> <ins>widths. To simplify
implementations, user agents may use a single page area width
on left, right, and first pages. In</ins> this <del>specification). Note. Future versions</del><ins>case, the page area width</ins>
of <del>CSS may include other</del><ins>the first</ins> page <del>pseudo-classes. 13.2.5</del><ins>should be used.</ins>
<h3><ins>13.2.3</ins> <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 <ins>current</ins> 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. <del>Also,</del><ins>As
another example,</ins> when boxes are positioned absolutely <del>,</del><ins>or relatively,</ins>
they may end up in "inconvenient" locations. For example, images may
be placed on the edge of the page box or 100,000 <del>inches</del><ins>meters</ins> below the page
box.
<P> <del>A specification for</del>The exact formatting of such elements lies outside the scope of
this <del>document.</del><ins>specification.</ins> 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 <del>don't</del><ins>do not</ins> want to
print 100 blank pages).
<li> <del>Note, however, that generating a small number of empty page boxes may be necessary to honor the 'left' and 'right' values for 'page-break-before' and 'page-break-after' .</del>Authors should not position elements in inconvenient locations
just to avoid rendering them.
<li> <del>Instead: To suppress box generation entirely, set the 'display' property to 'none'. To make a box invisible, use the 'visibility' property.</del>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> <del>The following sections explain</del><ins>This section describes</ins> page <del>formatting</del><ins>breaks</ins> in <del>CSS2.</del><ins>CSS 2.1.</ins> 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-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"><ins>Page</ins> break <del>before/after elements</del><ins>properties</ins></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 <ins>(but see text)</ins>
<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><ins>Computed value:</ins></em><ins> </ins><td><ins>as specified</ins>
</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 <ins>(but see text)</ins>
<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><ins>Computed value:</ins></em><ins> </ins><td><ins>as specified</ins>
</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 <ins>(but see text)</ins>
<tr valign=baseline><td><em>Inherited:</em> <td> <del>yes</del><ins>no</ins>
<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><ins>Computed value:</ins></em><ins> </ins><td><ins>as specified</ins>
</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>A <ins>conforming user agent
may interpret the values 'left' and 'right' as 'always'.</ins>
<p><ins>A</ins> 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> <del>See the section on allowed page breaks for the exact rules on how these properties may force or suppress a page break. 13.3.2 Using named pages: 'page' 'page' Value: <identifier> | auto Initial: auto Applies to: block-level elements Inherited: yes Percentages: N/A Media: visual , paged The 'page' property can be used to specify a particular type of page where an element should be displayed. Example(s): This example will put all tables on a right-hand side landscape page (named "rotated"): @page rotated {size: landscape} TABLE {page: rotated; page-break-before: right} The 'page' property works as follows: If a block box with inline content has a 'page' property that is different from the preceding block box with inline content, then one or two page breaks are inserted between them, and the boxes after</del><ins>User Agents must apply these properties to block-level elements
in</ins> the <del>break are rendered on a page box</del><ins>normal flow</ins> of the <del>named type. See "Forced</del><ins>root element. User agents may also apply
these properties to other elements, e.g., 'table-row' elements.</ins>
<p><ins>When a</ins> page <del>breaks" below. Example(s): In this example, the two tables are rendered on landscape pages (indeed, on</del><ins>break splits a box,</ins> the <del>same page, if they fit),</del><ins>box's margins, borders,</ins> and
<ins>padding have no visual effect where</ins> the <del>page type "narrow" is not used at all, despite having been set on the DIV: @page narrow {size: 9cm 18cm} @page rotated {size: landscape} DIV {page: narrow} TABLE {page: rotated} with this document:: <DIV> <TABLE>...</TABLE> <TABLE>...</TABLE> </DIV> 13.3.3</del><ins>split occurs.</ins>
<h3><ins>13.3.2</ins> <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> <del>block-level</del><ins>block container</ins> 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><ins>Computed value:</ins></em><ins> </ins><td><ins>as specified</ins>
</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> <del>block-level</del><ins>block container</ins> 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><ins>Computed value:</ins></em><ins> </ins><td><ins>as specified</ins>
</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 <del>of</del><ins>in</ins> a <del>paragraph</del><ins>block container</ins> 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 <del>of</del><ins>in</ins> a <del>paragraph</del><ins>block container</ins> that must be left at the top of a page.
Examples of how they are used to control page breaks are given below.
<p><ins>Only positive values are allowed.</ins>
<P>For information about paragraph formatting, please consult the
section on <a href="visuren.html#line-box">line boxes</a>.
<h3> <del>13.3.4</del><ins>13.3.3</ins> <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 <del>block</del><ins>block-level</ins> boxes. When <del>a</del><ins>an unforced</ins> page
break occurs here, the <a href="cascade.html#used-value"> <del>computed</del><ins>used</ins>
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'. <ins>When a forced page break occurs here, the used value of
the relevant</ins> <a href="box.html#propdef-margin-bottom" class="noxref"><span
class="propinst-margin-bottom"><ins>'margin-bottom'</ins></span></a> <ins>property is set
to '0'; the relevant</ins> <a href="box.html#propdef-margin-top" class="noxref"><span
class="propinst-margin-top"><ins>'margin-top'</ins></span></a> <ins>used value may either
be set to '0' or retained.</ins>
<li>Between <a href="visuren.html#line-box">line boxes</a>
inside a <a href="visuren.html#block-boxes">block <ins>container</ins></a> box.
<li><ins>Between the content edge of a block container box and the outer edges of its
child content (margin edges of block-level children or line box edges
for inline-level children) if there is a (non-zero) gap between them.</ins>
</ol>
<p class=note><ins>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.</ins>
<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
<del>the nearest</del><ins>a</ins> 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) <ins>or (3)</ins> 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
<ins>of the element and all its ancestors</ins> is 'auto'.
</ul>
<p>If the above <del>doesn't</del><ins>does not</ins> provide enough break points to keep content
from overflowing the page boxes, then rules <ins>A,</ins> B and D are dropped in
order to find additional breakpoints.
<p>If that still does not lead to sufficient break points, <del>rules A and</del><ins>rule</ins>
C <del>are</del><ins>is</ins> dropped as well, to find still more break points.
<h3> <del>Page breaks cannot occur inside boxes that are absolutely positioned . 13.3.5</del><ins>13.3.4</ins> <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> <del>A page break must also occur at (1) if the last line box above this margin and the first one below it do not have the same value for 'page' . 13.3.6</del><ins>13.3.5</ins> <a name="best-page-breaks">"Best" page breaks</a></h3>
<p> <del>CSS2</del><ins>CSS 2.1</ins> does <em>not</em> define which of a set of allowed page breaks
must be used; <del>CSS2</del><ins>CSS 2.1</ins> does not forbid a user agent from breaking at every
possible break point, or not to break at all. But <del>CSS2</del><ins>CSS 2.1</ins> 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 <del>don't</del><ins>do not</ins> end with a forced break appear to have about
the same height.
<li>Avoid breaking inside a <del>block that has a border. Avoid breaking inside a table. Avoid breaking inside a floated element</del><ins>replaced element.</ins>
</ul>
<div class="example"><P style="display:none">Example(s):</P><P>
Suppose, for example, that the style sheet
contains <del>'orphans :</del><ins>'orphans:</ins> 4', <del>'widows :</del><ins>'widows:</ins> 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-context">page context</a> obey
the <a href="cascade.html">cascade</a> just like normal <del>CSS2</del><ins>CSS</ins>
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>