-
Notifications
You must be signed in to change notification settings - Fork 792
Expand file tree
/
Copy pathOverview.html
More file actions
1709 lines (1295 loc) · 62 KB
/
Overview.html
File metadata and controls
1709 lines (1295 loc) · 62 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
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html lang=en>
<head profile="http://www.w3.org/2006/03/hcard"><meta
content="text/html; charset=utf-8" http-equiv=Content-Type>
<title>CSS Fragmentation Module Level 3</title>
<link href="../default.css" rel=stylesheet type="text/css">
<link href="http://www.w3.org/StyleSheets/TR/W3C-ED.css" rel=stylesheet
type="text/css">
<body>
<div class=head> <!--begin-logo-->
<p><a href="http://www.w3.org/"><img alt=W3C height=48
src="http://www.w3.org/Icons/w3c_home" width=72></a> <!--end-logo-->
<h1 id=css-fragmentation-module>CSS Fragmentation Module Level 3</h1>
<h2 class="no-num no-toc" id=longstatus-date>Editor's Draft 24 May 2012</h2>
<dl>
<dt>This version:</dt>
<!-- <dd><a href="http://www.w3.org/TR/2012/ED-css3-break-20120524/">http://www.w3.org/TR/2012/WD-css3-break-20120524/</a></dd> -->
<dd><a
href="http://dev.w3.org/csswg/css3-break/">http://dev.w3.org/csswg/css3-break/</a>
<dt>Latest version:
<dd><a
href="http://www.w3.org/TR/css3-break/">http://www.w3.org/TR/css3-break/</a>
<dt>Editor's Draft:
<dd><a
href="http://dev.w3.org/csswg/css3-break/">http://dev.w3.org/csswg/css3-break/</a>
<dt>Previous version:
<dd>None
<dt>Editors:
<dd class=vcard><span class=fn>Rossen Atanassov</span>, <span
class=org><a class="fn org url"
href="http://www.microsoft.com/">Microsoft Corporation</a></span>, <span
class=email>ratan@microsoft.com</span>
<dd class=vcard><span class=fn><a class=fn
href="http://fantasai.inkedblade.net/contact">Elika J.
Etemad</a></span>, <span class=org><a class="fn org url"
href="http://www.mozilla.org/">Mozilla Corporation</a></span>
<dt>Issues List:
<dd><a
href="http://wiki.csswg.org/spec/css3-break">http://wiki.csswg.org/spec/css3-break</a>
<dt>Discussion:
<dd><a
href="http://lists.w3.org/Archives/Public/www-style/">www-style@w3.org</a>
with subject line "<code>[css3-break] …message topic…</code>"
</dl>
<!--begin-copyright-->
<p class=copyright><a
href="http://www.w3.org/Consortium/Legal/ipr-notice#Copyright"
rel=license>Copyright</a> © 2012 <a href="http://www.w3.org/"><abbr
title="World Wide Web Consortium">W3C</abbr></a><sup>®</sup> (<a
href="http://www.csail.mit.edu/"><abbr
title="Massachusetts Institute of Technology">MIT</abbr></a>, <a
href="http://www.ercim.eu/"><abbr
title="European Research Consortium for Informatics and Mathematics">ERCIM</abbr></a>,
<a href="http://www.keio.ac.jp/">Keio</a>), All Rights Reserved. W3C <a
href="http://www.w3.org/Consortium/Legal/ipr-notice#Legal_Disclaimer">liability</a>,
<a
href="http://www.w3.org/Consortium/Legal/ipr-notice#W3C_Trademarks">trademark</a>
and <a
href="http://www.w3.org/Consortium/Legal/copyright-documents">document
use</a> rules apply.</p>
<!--end-copyright-->
<hr title="Separator for header">
</div>
<h2 class="no-num no-toc" id=abstract> Abstract</h2>
<p> This module describes the fragmentation model that partitions a flow
into pages. It builds on the Page model module and introduces and defines
the fragmentation model. It adds functionality for pagination, breaking
variable fragment size and orientation, widows and orphans.
<h2 class="no-num no-toc" id=status> Status of this document</h2>
<!--begin-status-->
<p>This is a public copy of the editors' draft. It is provided for
discussion only and may change at any moment. Its publication here does
not imply endorsement of its contents by W3C. Don't cite this document
other than as work in progress.
<p>The (<a
href="http://lists.w3.org/Archives/Public/www-style/">archived</a>) public
mailing list <a
href="mailto:www-style@w3.org?Subject=%5Bcss3-break%5D%20PUT%20SUBJECT%20HERE">
www-style@w3.org</a> (see <a
href="http://www.w3.org/Mail/Request">instructions</a>) is preferred for
discussion of this specification. When sending e-mail, please put the text
“css3-break” in the subject, preferably like this:
“[<!---->css3-break<!---->] <em>…summary of comment…</em>”
<p>This document was produced by the <a href="/Style/CSS/members">CSS
Working Group</a> (part of the <a href="/Style/">Style Activity</a>).
<p>This document was produced by a group operating under the <a
href="/Consortium/Patent-Policy-20040205/">5 February 2004 W3C Patent
Policy</a>. W3C maintains a <a href="/2004/01/pp-impl/32061/status"
rel=disclosure>public list of any patent disclosures</a> made in
connection with the deliverables of the group; that page also includes
instructions for disclosing a patent. An individual who has actual
knowledge of a patent which the individual believes contains <a
href="/Consortium/Patent-Policy-20040205/#def-essential">Essential
Claim(s)</a> must disclose the information in accordance with <a
href="/Consortium/Patent-Policy-20040205/#sec-Disclosure">section 6 of the
W3C Patent Policy</a>.</p>
<!--end-status-->
<!--<p>The following features are at risk: …</p>-->
<h2 class="no-num no-toc" id=contents> Table of contents</h2>
<!--begin-toc-->
<ul class=toc>
<li><a href="#intro"><span class=secno>1. </span> Introduction</a>
<ul class=toc>
<li><a href="#placement"><span class=secno>1.1. </span> Module
Interactions</a>
<li><a href="#values"><span class=secno>1.2. </span> Values</a>
</ul>
<li><a href="#fragmentation-model"><span class=secno>2. </span>
Fragmentation Model and Terminology</a>
<li><a href="#breaking-controls"><span class=secno>3. </span> Controlling
Breaks</a>
<ul class=toc>
<li><a href="#break-properties"><span class=secno>3.1. </span> Forced
breaks and keep-together: the ‘<code
class=property>break-before</code>’, ‘<code
class=property>break-after</code>’, ‘<code
class=property>break-inside</code>’ properties</a>
<li><a href="#widows-orphans"><span class=secno>3.2. </span> Breaks
inside elements: ‘<code class=property>orphans</code>’, ‘<code
class=property>widows</code>’</a>
</ul>
<li><a href="#breaking-rules"><span class=secno>4. </span> Rules for
Breaking</a>
<ul class=toc>
<li><a href="#possible-breaks"><span class=secno>4.1. </span> Possible
Break Points</a>
<li><a href="#break-types"><span class=secno>4.2. </span> Types of
Breaks</a>
<li><a href="#forced-breaks"><span class=secno>4.3. </span> Forced
breaks</a>
<li><a href="#unforced-breaks"><span class=secno>4.4. </span> Unforced
Breaks</a>
<li><a href="#best-breaks"><span class=secno>4.5. </span> Optimizing
Unforced Breaks</a>
</ul>
<li><a href="#breaking-boxes"><span class=secno>5. </span> Box Model for
Breaking</a>
<ul class=toc>
<li><a href="#varying-size-boxes"><span class=secno>5.1. </span>
Breaking into Varying-size Fragmentainers</a>
<li><a href="#break-margins"><span class=secno>5.2. </span> Margins at
Breaks</a>
<li><a href="#break-decoration"><span class=secno>5.3. </span>
Decorating Box Breaks</a>
</ul>
<li><a href="#conformance"><span class=secno>6. </span> Conformance</a>
<ul class=toc>
<li><a href="#conventions"><span class=secno>6.1. </span> Document
Conventions</a>
<li><a href="#conformance-classes"><span class=secno>6.2.
</span>Conformance Classes</a>
<li><a href="#partial"><span class=secno>6.3. </span> Partial
Implementations</a>
<li><a href="#experimental"><span class=secno>6.4. </span> Experimental
Implementations</a>
<li><a href="#testing"><span class=secno>6.5. </span> Non-Experimental
Implementations</a>
<li><a href="#cr-exit-criteria"><span class=secno>6.6. </span> CR Exit
Criteria</a>
</ul>
<li class=no-num><a href="#acknowledgments"> Acknowledgments</a>
<li class=no-num><a href="#references">References</a>
<ul class=toc>
<li class=no-num><a href="#normative-references">Normative
references</a>
<li class=no-num><a href="#other-references">Other references</a>
</ul>
<li class=no-num><a href="#index">Index</a>
<li class=no-num><a href="#property-index">Property index</a>
</ul>
<!--end-toc-->
<h2 id=intro><span class=secno>1. </span> Introduction</h2>
<p><em>This section is not normative.</em>
<p> In paged media (e.g., paper, transparencies, photo album pages, pages
displayed on computer screens as printed output simulations), as opposed
to <a href="http://www.w3.org/TR/CSS2/media.html#continuous-media-group">
continuous media</a>, the content of the document is split into one or
more discrete display surfaces. In order to avoid awkward breaks (such as
halfway through a line of text), the layout engine must be able to shift
around content that would fall across the page break. This process is
called <dfn id=pagination>pagination</dfn>.
<p> In CSS, in addition to paged media, certain layout features such as <a
href="http://www.w3.org/TR/css3-regions/">regions</a> <a
href="#CSS3-REGIONS"
rel=biblioentry>[CSS3-REGIONS]<!--{{CSS3-REGIONS}}--></a> and <a
href="http://www.w3.org/TR/css3-multicol/">multi-column layout</a> <a
href="#CSS3COL" rel=biblioentry>[CSS3COL]<!--{{CSS3COL}}--></a> create a
similarly fragmented environment. The generic term for breaking content
across containers is <dfn id=fragmentation>fragmentation</dfn>. This
module explains how content breaks across <a
href="#fragmentainer"><i>fragmentainers</i></a> such as pages and columns
and how such breaks can be <a href="#breaking-controls">controlled by the
author</a>.
<h3 id=placement><span class=secno>1.1. </span> Module Interactions</h3>
<p> This module replaces and extends the pagination controls defined in <a
href="#CSS21" rel=biblioentry>[CSS21]<!--{{CSS21}}--></a> <a
href="http://www.w3.org/TR/CSS21/page.html#page-breaks">section 13.3</a>
and in <a href="#CSS3PAGE"
rel=biblioentry>[CSS3PAGE]<!--{{CSS3PAGE}}--></a>.</p>
<!-- End section "Modules Interactions" -->
<h3 id=values><span class=secno>1.2. </span> Values</h3>
<p> This specification follows the <a
href="http://www.w3.org/TR/CSS21/about.html#property-defs"> CSS property
definition conventions</a> from <a href="#CSS21"
rel=biblioentry>[CSS21]<!--{{!CSS21}}--></a>. Value types not defined in
this specification are defined in CSS Level 2 Revision 1 <a href="#CSS21"
rel=biblioentry>[CSS21]<!--{{!CSS21}}--></a>. Other CSS modules may expand
the definitions of these value types: for example <a href="#CSS3COLOR"
rel=biblioentry>[CSS3COLOR]<!--{{CSS3COLOR}}--></a>, when combined with
this module, expands the definition of the <color> value type as
used in this specification.
<p> In addition to the property-specific values listed in their
definitions, all properties defined in this specification also accept the
<a href="http://www.w3.org/TR/CSS21/cascade.html#value-def-inherit">
inherit</a> keyword as their property value. For readability it has not
been repeated explicitly.
<h2 id=fragmentation-model><span class=secno>2. </span> Fragmentation Model
and Terminology</h2>
<dl>
<dt><dfn id=fragmented-flow>fragmented flow</dfn>
<dd> A content flow that is being laid out in a <a
href="#fragmentation-context"><i>fragmentation context</i></a>, such as a
<a href="http://www.w3.org/TR/css3-multicol/">multi-column element</a>, a
chain of <a href="http://www.w3.org/TR/css3-regions">CSS regions</a>, or
a <a href="http://www.w3.org/TR/css3-page/">paged media display</a>.
<dt><dfn id=fragmentation-container>fragmentation container</dfn> (<dfn
id=fragmentainer>fragmentainer</dfn>)
<dd> A box—such as a page box, column box, or region—that contains a
portion (or all) of a <a href="#fragmented-flow"><i>fragmented
flow</i></a>. Fragmentainers can be pre-defined, or generated as needed.
When breakable content overflows a fragmentainer in the block dimension,
instead of overflowing it breaks into the next container in its <a
href="#fragmentation-context"><i>fragmentation context</i></a>.
<dt><dfn id=fragmentation-context>fragmentation context</dfn>
<dd> An ordered series of <a
href="#fragmentainer"><i>fragmentainers</i></a>. A given fragmentation
context can only have one block flow direction across all its
fragmentainers.
<dt><dfn id=fragmentation-direction>fragmentation direction</dfn>
<dd> The block flow direction of the fragmentation context, i.e. the
direction in which content is fragmented.
<dt><dfn id=fragmentation0>fragmentation</dfn>
<dd> The process of splitting a content flow across the <a
href="#fragmentainer"><i>fragmentainers</i></a> that form a <a
href="#fragmentation-context"><i>fragmentation context</i></a>.
<dt><dfn id=box-fragment>box fragment</dfn> or <dfn
id=fragment>fragment</dfn>
<dd> The portion of a box that belongs to exactly one <a
href="#fragmentainer"><i>fragmentainer</i></a>. A box in continuous flow
always consists of only one fragment. A box in a fragmented flow consists
of one or more fragments.
<dt><dfn id=available-fragmentainer-extent>available fragmentainer
extent</dfn>
<dd> The remaining extent on the fragmentainer available to a given
element, i.e. between the end of preceding content on fragmentainer and
the edge of the fragmentainer.
</dl>
<p> Each <dfn id=fragmentation-break>fragmentation break</dfn> (hereafter,
<dfn id=break>break</dfn>) ends layout of the fragmented box in the
current <a href="#fragmentainer"><i>fragmentainer</i></a> and causes the
remaining content to be laid out in the next <a
href="#fragmentainer"><i>fragmentainer</i></a>, in some cases causing a
new fragmentainer to be generated to hold the deferred content. When
multiple flows are laid out in parallel, fragmentation is performed
independently in each flow.
<p> Breaking a fragmentainer F effectively splits the fragmentainer into
two fragmentainers (F<sub>1</sub> and F<sub>2</sub>). The only difference
is that the type of break between the two pieces F<sub>1</sub> and
F<sub>2</sub> is the <a href="#break-types">type of break</a> created by
the fragmentation context that split F, not the type of break normally
created by F's own fragmentation context.
<p class=note> Breaking inline content into lines is another form of
fragmentation, and similarly creates box fragments when it breaks <a
href="http://www.w3.org/TR/CSS21/visuren.html#inline-boxes">inline
boxes</a> across <a
href="http://www.w3.org/TR/CSS21/visuren.html#line-box">line boxes</a>.
However, inline breaking is not covered here; see <a href="#CSS3TEXT"
rel=biblioentry>[CSS3TEXT]<!--{{CSS3TEXT}}--></a> and the ‘<code
class=property>box-decoration-break</code>’ property in <a
href="#CSS3BG" rel=biblioentry>[CSS3BG]<!--{{CSS3BG}}--></a>.
<h2 id=breaking-controls><span class=secno>3. </span> Controlling Breaks</h2>
<p> The following sections explain how breaks are controlled in a
fragmented flow. Five properties indicate where the user agent may or
should break the content flow. In the case of pagination, the author can
also specify on which page (<a
href="http://www.w3.org/TR/css3-page/#left-right-first">left or right</a>)
the subsequent content should resume.
<h3 id=break-properties><span class=secno>3.1. </span> Forced breaks and
keep-together: the ‘<a href="#break-before"><code
class=property>break-before</code></a>’, ‘<a href="#break-after"><code
class=property>break-after</code></a>’, ‘<a href="#break-inside"><code
class=property>break-inside</code></a>’ properties</h3>
<table class=propdef summary="property definition">
<tbody>
<tr>
<td><em>Name:</em>
<td><dfn id=break-before>break-before</dfn>
<tr>
<td><em>Value:</em>
<td>auto | always | left | right | page | column | region | avoid |
avoid-page | avoid-column | avoid-region
<tr>
<td><em>Initial:</em>
<td>auto
<tr>
<td><em>Applies to:</em>
<td>block-level elements, table row groups, table rows (but see prose)
<tr>
<td><em>Inherited:</em>
<td>no
<tr>
<td><em>Percentages:</em>
<td>N/A
<tr>
<td><em>Media:</em>
<td>visual
<tr>
<td><em>Computed value:</em>
<td>specified value
</table>
<table class=propdef summary="property definition">
<tbody>
<tr>
<td><em>Name:</em>
<td><dfn id=break-after>break-after</dfn>
<tr>
<td><em>Value:</em>
<td>auto | always | left | right | page | column | region | avoid |
avoid-page | avoid-column | avoid-region
<tr>
<td><em>Initial:</em>
<td>auto
<tr>
<td><em>Applies to:</em>
<td>block-level elements, table row groups, table rows (but see prose)
<tr>
<td><em>Inherited:</em>
<td>no
<tr>
<td><em>Percentages:</em>
<td>N/A
<tr>
<td><em>Media:</em>
<td>visual
<tr>
<td><em>Computed value:</em>
<td>specified value
</table>
<table class=propdef summary="property definition">
<tbody>
<tr>
<td><em>Name:</em>
<td><dfn id=break-inside>break-inside</dfn>
<tr>
<td><em>Value:</em>
<td>auto | avoid | avoid-page | avoid-column | avoid-region
<tr>
<td><em>Initial:</em>
<td>auto
<tr>
<td><em>Applies to:</em>
<td>block-level elements, block containers, table row groups, table rows
(but see prose)
<tr>
<td><em>Inherited:</em>
<td>no
<tr>
<td><em>Percentages:</em>
<td>N/A
<tr>
<td><em>Media:</em>
<td>visual
<tr>
<td><em>Computed value:</em>
<td>specified value
</table>
<p> These properties describe page/column/region break behavior
before/after/inside the generated box. These values have the following
meaning:
<dl>
<dt> auto
<dd> Neither force nor forbid a break before/after/inside the principle
box.
<dt> always
<dd> Always force a break before/after the principle box.
<dt> avoid
<dd> Avoid a break before/after/inside the principle box.
<dt> left
<dd> Force one or two page breaks before/after the principle box so that
the next page is formatted as a left page.
<dt> right
<dd> Force one or two page breaks before/after the principle box so that
the next page is formatted as a right page.
<dt> page
<dd> Always force a page break before/after the principle box.
<dt> column
<dd> Always force a column break before/after the principle box.
<dt> region
<dd> Always force a region break before/after the principle box.
<dt> avoid-page
<dd> Avoid a page break before/after/inside the principle box.
<dt> avoid-column
<dd> Avoid a column break before/after/inside the principle box.
<dt> avoid-region
<dd> Avoid a region break before/after/inside the principle box.
</dl>
<p> A potential page/column/region break location is typically under the
influence of the containing block's ‘<a href="#break-inside"><code
class=property>break-inside</code></a>’ property, the ‘<a
href="#break-after"><code class=property>break-after</code></a>’
property of the preceding element, and the ‘<a
href="#break-before"><code class=property>break-before</code></a>’
property of the following element. When these properties have values other
than ‘<code class=css>auto</code>’, the <dfn
id=forced-break-values>forced break values</dfn> (‘<code
class=css>always</code>’, ‘<code class=css>left</code>’, ‘<code
class=css>right</code>’, ‘<code class=css>page</code>’, ‘<code
class=css>column</code>’ and ‘<code class=css>region</code>’) take
precedence over the <dfn id=avoid-break-values>avoid break values</dfn>
(‘<code class=css>avoid</code>’, ‘<code
class=css>avoid-page</code>’, ‘<code class=css>avoid-column</code>’
and ‘<code class=css>avoid-region</code>’). See the section on <a
href="#breaking-rules">rules for breaking</a> for the exact rules on how
these properties affect forced breaks.
<p> User Agents must apply these properties to block-level boxes and to
table rows, table row groups, and—in the case of ‘<a
href="#break-inside"><code
class=property>break-inside</code></a>’—block containers in the normal
flow of the root fragmented element. User agents should also apply these
properties to floated boxes whose containing block is in the normal flow
of the root fragmented element. User agents may also apply these
properties to other boxes.
<h3 id=widows-orphans><span class=secno>3.2. </span> Breaks inside
elements: ‘<a href="#orphans"><code
class=property>orphans</code></a>’, ‘<a href="#widows"><code
class=property>widows</code></a>’</h3>
<table class=propdef summary="property definition">
<tbody>
<tr>
<th>Name:
<td><dfn id=orphans>orphans</dfn>
<tr>
<th>Value:
<td><integer>
<tr>
<th>Initial:
<td>2
<tr>
<th>Applies to:
<td>block containers
<tr>
<th>Inherited:
<td>yes
<tr>
<th>Percentages:
<td>N/A
<tr>
<th>Media:
<td>visual
<tr>
<th>Computed value:
<td>specified value
</table>
<table class=propdef summary="property definition">
<tbody>
<tr>
<th>Name:
<td><dfn id=widows>widows</dfn>
<tr>
<th>Value:
<td><integer>
<tr>
<th>Initial:
<td>2
<tr>
<th>Applies to:
<td>block containers
<tr>
<th>Inherited:
<td>yes
<tr>
<th>Percentages:
<td>N/A
<tr>
<th>Media:
<td>visual
<tr>
<th>Computed value:
<td>specified value
</table>
<p> The ‘<a href="#orphans"><code class=property>orphans</code></a>’
property specifies the minimum number of line boxes in a block container
that must be left in a <a href="#fragment"><i>fragment</i></a> before a
fragment break. The ‘<a href="#widows"><code
class=property>widows</code></a>’ property specifies the minimum number
of line boxes of a block container that must be left in a <a
href="#fragment"><i>fragment</i></a> after a break. Examples of how they
are used to control fragmentation breaks are given <a
href="#widows-orphans-example">below</a>.
<p> Only positive integers are allowed as values of ‘<a
href="#orphans"><code class=property>orphans</code></a>’ and ‘<a
href="#widows"><code class=property>widows</code></a>’. Negative values
and zero are invalid must cause the declaration to be <a
href="http://www.w3.org/TR/CSS21/conform.html#ignore">ignored</a>.
<p> If a block contains fewer lines than the value of ‘<a
href="#widows"><code class=property>widows</code></a>’ or ‘<a
href="#orphans"><code class=property>orphans</code></a>’, the rule
simply becomes that all lines in the block must be kept together.
<h2 id=breaking-rules><span class=secno>4. </span> Rules for Breaking</h2>
<p> A fragmented flow may be broken across fragmentainers at a number of <a
href="#possible-breaks">possible break points</a>. In the case of <a
href="#forced-breaks">forced breaks</a>, the UA is required to break the
flow at that point. In the case of <a href="#unforced-breaks">unforced
breaks</a> the UA has to choose among the possible breaks that are
allowed.
<p> Some content is not fragmentable, for example many types of <a
href="">replaced elements</a> (such as images or video), scrollable
elements, or a single line of text content. Such content is considered
<dfn id=monolithic>monolithic</dfn>: it contains no possible break points.
In addition to any content which is not fragmentable, UAs may consider as
<a href="#monolithic"><i>monolithic</i></a> any elements with ‘<code
class=property>overflow</code>’ set to ‘<code class=css>auto</code>’
or ‘<code class=css>scroll</code>’ and any elements with ‘<code
class=css>overflow: hidden</code>’ and a non-‘<code
class=css>auto</code>’ <a
href="http://www.w3.org/TR/css3-writing-modes/#extent">logical height</a>
(and no specified maximum logical height).
<h3 id=possible-breaks><span class=secno>4.1. </span> Possible Break Points</h3>
<p> Fragmentation splits boxes in the block flow dimension. In
block-and-inline flow, breaks may occur at the following places:
<dl>
<dt id=btw-blocks>Class 1
<dd> Between sibling boxes of the following types:
<dl>
<dt>Block-parallel Fragmentation
<dd> When the block flow direction of the siblings' containing block is
parallel to that of the fragmentation context: block-level boxes, table
row group boxes, table row boxes, multi-column column row boxes
<dt>Block-perpendicular Fragmentation
<dd> When the block flow direction of the siblings' containing block is
perpendicular to that of the fragmentation context: table column group
boxes, table column boxes, multi-column column boxes
</dl>
<dt id=btw-lines>Class 2
<dd> Between line boxes inside a block container box.
<dt id=end-block>Class 3
<dd> 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) <em>if</em> there is a (non-zero) gap
between them.
</dl>
<p class=note> Other layout models may add breakpoints to the above
classes.
<p> Since breaks are only allowed between siblings (1), not between a box
and its container, a ‘<a href="#break-before"><code
class=property>break-before</code></a>’ value on a first-child box is
propagated to its container. Likewise a ‘<a href="#break-after"><code
class=property>break-after</code></a>’ value on a last-child box is
propagated to its container.
<p id=monolithic-breaking> The UA is not required to fragment the contents
of <a href="#monolithic"><i>monolithic</i></a> elements, and may instead
either slice the element's graphical representation as necessary to
fragment it or treat its box as unbreakable and overflow the
fragmentainer. In both cases it must treat the element as having ‘<code
class=css>break-inside: avoid</code>’, i.e. only slice or overflow at
the fragmentainer edge if there are no <a href="#possible-breaks">possible
break points</a> on the fragmentainer.
<p> When paginating, if there are no possible break points below the top of
the page, and not all the content fits, the UA may break anywhere in order
to avoid losing content off the edge of the page.
<h3 id=break-types><span class=secno>4.2. </span> Types of Breaks</h3>
<p> There are different types of breaks in CSS, defined based on the type
of fragmentainers they span:
<dl>
<dt><dfn id=page-break>page break</dfn>
<dd> A break between two <a
href="http://www.w3.org/TR/css3-page/#page-box">page boxes</a>. <a
href="#CSS3PAGE" rel=biblioentry>[CSS3PAGE]<!--{{!CSS3PAGE}}--></a>
<dt><dfn id=spread-break>spread break</dfn>
<dd> A break between two page boxes that are not associated with <a
href="http://www.w3.org/TR/css3-page/#facing-pages">facing pages</a>. A
spread break is always also a page break. <a href="#CSS3PAGE"
rel=biblioentry>[CSS3PAGE]<!--{{!CSS3PAGE}}--></a>
<dt><dfn id=column-break>column break</dfn>
<dd> A break between two <a
href="http://www.w3.org/TR/css3-multicol/#column-box">column boxes</a>.
Note that if the column boxes are on different pages, then the break is
also a <a href="#page-break"><i>page break</i></a>. <a href="#CSS3COL"
rel=biblioentry>[CSS3COL]<!--{{!CSS3COL}}--></a>
<dt><dfn id=region-break>region break</dfn>
<dd> A break between two <a
href="http://www.w3.org/TR/css3-regions/#regions">regions</a>. Note that
if the region boxes are on different pages, then the break is also a <a
href="#page-break"><i>page break</i></a>. <a href="#CSS3-REGIONS"
rel=biblioentry>[CSS3-REGIONS]<!--{{!CSS3-REGIONS}}--></a>
</dl>
<p class=note> A fifth type of break is the <dfn id=line-break>line
break</dfn>, which is a break between two <a
href="http://www.w3.org/TR/CSS21/visuren.html#line-box">line boxes</a>.
These are not covered in this specification; see <a href="#CSS21"
rel=biblioentry>[CSS21]<!--{{!CSS21}}--></a>.
<h3 id=forced-breaks><span class=secno>4.3. </span> Forced breaks</h3>
<p> A forced break then occurs at <a href="#btw-blocks">(1)</a> if, among
the ‘<a href="#break-after"><code
class=property>break-after</code></a>’ properties specified on or
propagated to the earlier sibling box and the ‘<a
href="#break-before"><code class=property>break-before</code></a>’
properties specified on or propagated to the later sibling box there is at
least one with a <i>forced break value</i>.
<p> When multiple <a href="#forced-break-values"><i>forced break
values</i></a> apply to a single break point, they combine such all types
of break are honored and no content-empty page boxes are generated, except
for at most one content-empty page as may be required by the ‘<code
class=css>right</code>’ or ‘<code class=css>left</code>’ values to
position ensuing content on a right- or left-facing page. When ‘<code
class=css>left</code>’ and ‘<code class=css>right</code>’ are both
combined, the value specified on the latest element in the flow wins.
<p class=note> A page break must also occur at <a
href="#btw-blocks">(1)</a> if the last line box above this margin and the
first one below it do not have the same value for ‘<code
class=property>page</code>’. See <a href="#CSS3PAGE"
rel=biblioentry>[CSS3PAGE]<!--{{!CSS3PAGE}}--></a>
<h3 id=unforced-breaks><span class=secno>4.4. </span> Unforced Breaks</h3>
<p> While <a href="#breaking-controls">breaking controls</a> can force
breaks, they can also discourage them. The following rules control whether
breaking at a <a href="#possible-breaks">possible break point</a> is
allowed:
<dl>
<dt>Rule A
<dd> A fragmented flow may break at <a href="#btw-blocks">(1)</a> only if
all the ‘<a href="#break-after"><code
class=property>break-after</code></a>’ and ‘<a
href="#break-before"><code class=property>break-before</code></a>’
values applicable to this break point allow it, which is when at least
one of them forces a break or when all of them are ‘<code
class=css>auto</code>’.
<dt>Rule B
<dd> However, if all of them are ‘<code class=css>auto</code>’ and a
common ancestor of all the elements has a ‘<a
href="#break-inside"><code class=property>break-inside</code></a>’
value of ‘<code class=css>avoid</code>’, then breaking here is not
allowed.
<dt>Rule C
<dd> Breaking at <a href="#btw-lines">(2)</a> is allowed only if the
number of line boxes between the break and the start of the enclosing
block box is the value of ‘<a href="#orphans"><code
class=property>orphans</code></a>’ or more, and the number of line
boxes between the break and the end of the box is the value of ‘<a
href="#widows"><code class=property>widows</code></a>’ or more.
<dt>Rule D
<dd> Additionally, breaking at <a href="#btw-blocks">(2)</a> or <a
href="#end-block">(3)</a> is allowed only if the ‘<a
href="#break-inside"><code class=property>break-inside</code></a>’
property of all ancestors is ‘<code class=css>auto</code>’.
</dl>
<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. In this case the UA may use the ‘<code
class=css>avoid</code>’s that are in effect at those points to weigh the
appropriateness of the new breakpoints; however, this specification does
not suggest a precise algorithm.
<p> If that still does not lead to sufficient break points, rule C is
dropped as well, to find still more break points.
<h3 id=best-breaks><span class=secno>4.5. </span> Optimizing Unforced
Breaks</h3>
<p>While CSS3 requires that a fragmented flow must break at allowed break
points in order to avoid overflowing the fragmentainers in its
fragmentation context, it does not define whether content breaks at a
particular <a href="#unforced-breaks">allowed break</a>. However, it is
recommended that user agents observe the following guidelines (while
recognizing that they are sometimes contradictory):
<ul>
<li>Break as few times as possible.
<li>Make all fragmentainers that don't end with a forced break appear to
be equally filled with content.
<li>Avoid breaking inside a replaced element.
</ul>
<div class=example id=widows-orphans-example>
<p> Suppose, for example, that the style sheet contains ‘<code
class=css>orphans : 4</code>’, ‘<code class=css>widows : 2</code>’,
and there are 20 lines (line boxes) available at the bottom of the
current page, and the next block in normal flow is considered for
placement:</p>
<ul>
<li> If the block contains 20 line boxes or fewer, it should be placed on
the current page.
<li> If the block contains 21 or 22 line boxes, the second fragment of
the paragraph must not violate the ‘<a href="#widows"><code
class=property>widows</code></a>’ constraint, and so the second
fragment must contain at least two line boxes; likewise the first
fragment must contain at least four line boxes.
<li> If the block contains 23 line boxes or more, the first fragment
should contain 20 lines and the second fragment the remaining lines. But
if any fragment of the block is placed on the current page, that
fragment must contain at least four line boxes and the second fragment
at least two line boxes.
</ul>
<p> Now suppose that ‘<a href="#orphans"><code
class=property>orphans</code></a>’ is ‘<code class=css>10</code>’,
‘<a href="#widows"><code class=property>widows</code></a>’ is
‘<code class=css>20</code>’, and there are 8 lines available at the
bottom of the current page:</p>
<ul>
<li> If the block contains 8 lines or fewer, it should be placed on the
current page.
<li> If the block contains 9 lines or more, it must NOT be split (that
would violate the ‘<a href="#orphans"><code
class=property>orphans</code></a>’ constraint), so it must move as a
block to the next page.
</ul>
</div>
<h2 id=breaking-boxes><span class=secno>5. </span> Box Model for Breaking</h2>
<p class=note> The sizing terminology used in this section is defined in
Appendix D of <a href="#CSS3-WRITING-MODES"
rel=biblioentry>[CSS3-WRITING-MODES]<!--{{CSS3-WRITING-MODES}}--></a>.
<h3 id=varying-size-boxes><span class=secno>5.1. </span> Breaking into
Varying-size Fragmentainers</h3>
<p> When a flow is fragmented into varying-size fragmentainers, the
following rules are observed for adapting layout:
<ul>
<li> Intrinsic sizes are calculated and maintained across the entire
element. Where an initial containing block size is needed to resolve an
intrinsic size, assume the size of the first fragmentainer defining a
pagination context.
<li> Layout is performed per-fragmentainer, with each fragmentainer
continuing progress from the breakpoint on the previous, but
recalculating sizes and positions using its own size as if the entire
element were fragmented across fragmentainers of this size. Progress is
measured in percentages (not absolute lengths) of used/available
fragmentainer extent and in amount of used/remaining content. However,
when laying out <a href="#monolithic"><i>monolithic</i></a> elements, the
UA may instead maintain a consistent measure and resolved extent across
fragmentainers.
<li><strong class=issue>Option A:</strong> Fragments of boxes that began
on a previous fragmentainer must start at the top of the new
fragmentainer. If this results in multiple boxes side-by-side that would
otherwise be staggered (if they were not continuations) in order to fit,
the elements' widths are reduced (on that fragmentainer only) in
proportion to their original widths until they fit. However they are not
reduced past their min-content width or in case the width copmutes to a
non-percent length value.
<div class=figure>
<pre>First page
<!-- -->+----------------------------------+