-
Notifications
You must be signed in to change notification settings - Fork 708
/
Copy pathOverview.bs
747 lines (636 loc) · 30.5 KB
/
Overview.bs
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
<pre class="metadata">
Title: CSS Overflow Module Level 3
Status: ED
Work Status: Revising
ED: https://drafts.csswg.org/css-overflow-3/
Shortname: css-overflow
Group: csswg
Level: 3
TR: https://www.w3.org/TR/css-overflow-3/
Previous version: https://www.w3.org/TR/2016/WD-css-overflow-3-20160531/
Previous version: https://www.w3.org/TR/2013/WD-css-overflow-3-20130418/
Editor: L. David Baron, Mozilla https://www.mozilla.org/, https://dbaron.org/, w3cid 15393
Editor: Elika J. Etemad / fantasai, Invited Expert, http://fantasai.inkedblade.net/contact, w3cid 35400
Editor: Florian Rivoal, On behalf of Bloomberg, http://florian.rivoal.net/, w3cid 43241
Abstract: This module contains the features of CSS relating to scrollable overflow handling in visual media.
!Change Log: <a href="https://hg.csswg.org/drafts/log/tip/css-overflow/Overview.bs">from 27 January 2015 to the present</a>
!Change Log: <a href="https://hg.csswg.org/drafts/log/tip/css-overflow/Overview.src.html">from 28 March 2013 to 27 January 2015</a>
!Change Log: <a href="https://hg.csswg.org/drafts/log/tip/css3-overflow/Overview.src.html">from 31 July 2012 to 27 March 2013</a>
Ignored Vars: B, P
Ignored Terms: padding edge, viewport, line box, flex order
At Risk: the 'max-lines' property
Status Text: <strong>This update trims away most of the experimental new ideas
for handling overflow that were described in the <a href="https://www.w3.org/TR/2013/WD-css-overflow-3-20130418/">previous Working Draft</a>.
These ideas are not abandoned; they are merely <a href="https://drafts.csswg.org/css-overflow/">deferred until Level 4</a>.</strong>
Level 3 is focused solely on completing a spec for the existing, shipped 'overflow' features;
work will resume on fragmented overflow and other fun things once this is completed.
</pre>
<!-- FIXME: Regressions from bikeshed conversion: -->
<!-- - Value lines in propdef tables no longer link to #values. -->
<!-- - no longer says "Test suite: none yet" -->
<!-- - Abstract has the most introductory sentence last -->
<!-- FIXME: other bikeshed issues -->
<pre class="link-defaults">
spec:css-transforms-2; type:property; text:transform-style
type: dfn; spec:css-multicol-1; text:overflow column
type: dfn; spec:css-transforms-2; text:3d rendering context
</pre>
<!-- FIXME: the break-* link doesn't actually work! -->
<pre class="anchors">
url: https://www.w3.org/TR/2008/CR-css3-marquee-20081205/#the-overflow-style; type: property; text: overflow-style;
</pre>
<h2 id="intro">
Introduction</h2>
In CSS Level 1 [[CSS1]], placing more content than would fit
inside an element with a specified size
was generally an authoring error.
Doing so caused the content to extend
outside the bounds of the element,
which would likely cause
that content to overlap with other elements.
CSS Level 2 [[CSS21]] introduced the 'overflow' property,
which allows authors to have overflow be handled by scrolling,
which means it is no longer an authoring error.
It also allows authors to specify
that overflow is handled by clipping,
which makes sense when the author's intent
is that the content not be shown.
This specification introduces the long-standing de-facto 'overflow-x' and 'overflow-y' properties,
adds a ''overflow/clip'' value,
and defines overflow handling more fully.
[Something something 'max-lines'.]
<!--
████████ ██ ██ ████████ ████████ ██████
██ ██ ██ ██ ██ ██ ██ ██
██ ████ ██ ██ ██ ██
██ ██ ████████ ██████ ██████
██ ██ ██ ██ ██
██ ██ ██ ██ ██ ██
██ ██ ██ ████████ ██████
-->
<h2 id="overflow-concepts">
Types of Overflow</h2>
CSS uses the term <dfn export>overflow</dfn> to describe
the contents of a box
that extend outside one of that box's edges
(i.e., its <i>content edge</i>, <i>padding edge</i>,
<i>border edge</i>, or <i>margin edge</i>).
The term might be interpreted as
elements or features that cause this overflow,
the non-rectangular region occupied by these features,
or, more commonly, as
the minimal rectangle that bounds that region.
A box's overflow is computed based on the layout and styling of the box itself
and of all descendants whose <a>containing block chain</a>
includes the box.
In most cases, <a>overflow</a>
can be computed for any box
from the bounds and properties of that box itself,
plus the <a>overflow</a>
of each of its children.
However, this is not always the case; for example,
when ''transform-style: preserve-3d'' [[CSS3-TRANSFORMS]] is used on
some of the children, any of their descendants with
''transform-style: preserve-3d'' must also be examined.
There are two different types of overflow,
which are used for different purposes by the UA:
<ul>
<li><a>ink overflow</a>
<li><a>scrollable overflow</a>
</ul>
<h3 id="ink">Ink Overflow</h3>
The <dfn export>ink overflow</dfn> of a box
is the part of that box and its contents that
creates a visual effect outside of
the box's border box.
Ink overflow is the overflow of painting effects defined to not affect layout
or otherwise extend the <a>scrollable overflow region</a>,
such as <a href="https://www.w3.org/TR/css-backgrounds/#box-shadow">box shadows</a>,
<a href="">border images</a>,
<a href="https://www.w3.org/TR/css-text-decor-3/">text decoration</a>,
overhanging glyphs (with negative side bearings,
or with ascenders/descenders extending outside the em box),
<a href="https://www.w3.org/TR/CSS2/ui.html#dynamic-outlines">outlines</a>,
etc.
Since some effects in CSS (for example, the blurs in
'text-shadow' [[CSS-TEXT-3]] and 'box-shadow' [[CSS-BACKGROUNDS-3]],
which are theoretically infinite)
do not define what visual extent they cover, the extent
of the <a>ink overflow</a> is undefined.
The <dfn export>ink overflow region</dfn> is the non-rectangular area
occupied by the <a>ink overflow</a>
of a box and its contents,
and the <dfn export>ink overflow rectangle</dfn> is
the minimal rectangle whose axes are aligned to the box's axes
and that contains the <a>ink overflow region</a>.
Note that the <a>ink overflow rectangle</a> is a rectangle
in the box's coordinate system, but might be non-rectangular
in other coordinate systems due to transforms. [[CSS3-TRANSFORMS]]
<h3 id="scrollable">
Scrollable Overflow</h3>
The <dfn export>scrollable overflow</dfn> of a box is the
set of things extending outside of that box's padding edge
for which a scrolling mechanism needs to be provided.
The <dfn export>scrollable overflow region</dfn> is the non-rectangular region
occupied by the <a>scrollable overflow</a>, and the
<dfn export>scrollable overflow rectangle</dfn> is
the minimal rectangle whose axes are aligned to the box's axes
and that contains the <a>scrollable overflow region</a>.
The <a>scrollable overflow region</a> is the union of:
<ul>
<li>
the box’s own content and padding areas
<div class=issue>
There's disagreement on the scrolling model.
2.1 apparently defined that you scrolled the *content* area;
the content would overflow the content-box,
and you would union that overflow with the content box to find the scrollable area.
In particular, this means that the content would be offset by the start-sides padding,
but if it overflowed,
it would go right to the edge on the end sides.
This is what Firefox and IE do.
At least some authors (and spec authors)
instead have the mental model that the padding box is what's scrollable,
so when you scroll to the end of the overflow,
there's the right/bottom padding.
Chrome/WebKit do this for the block axis, at least.
They're somewhat inconsistent for the inline axis;
there's something weird about how they handle lineboxes.
It seems that the block-axis padding is probably web-compatible to honor.
It's unclear that the inline-axis padding will be.
Further experimentation is needed.
</div>
<li>
all line boxes directly contained by the box
<li>
the border boxes
of all boxes for which it is the containing block
and whose border boxes are positioned not wholly outside
its <a>block-start</a> or <a>inline-start</a> padding edges,
accounting for transforms by projecting each box onto
the plane of the element that establishes its <a>3D rendering context</a>.
[[!CSS3-TRANSFORMS]]
Issue: Is this description of handling transforms
sufficiently accurate?
<li>
the <a>scrollable overflow regions</a> of all of the above boxes
(accounting for transforms as described above),
provided they themselves have ''overflow: visible''
(i.e. do not themselves trap the overflow)
and that <a>scrollable overflow</a> is not already clipped
(e.g. by the 'clip' property or the 'contain' property).
Note: The 'mask-*' properties [[!CSS-MASKING-1]]
do not affect the <a>scrollable overflow region</a>.
Issue: Need to evaluate compat of honoring or ignoring 'clip' and 'clip-path'.
<li>
Optionally,
additional padding on the end-edge sides,
corresponding to the end-side padding of the <a>scroll container</a>, such that the end edges of its in-flow content
coincide with the end edges of its content area
when scrolled to the end.
Issue(129): It's not yet clear if including the end-side padding in the scrollable layer is Web-compatible, so this clause is under investigation.
It appears that Chrome and Safari include such padding <a href="https://bug748518.bmoattachments.org/attachment.cgi?id=618078">in the block axis</a>;
and the behavior in the inline axis is <a href="http://jsbin.com/digadoyohi/1/edit?html,css,output">not</a> <a href="http://jsbin.com/vexahocayi/1/edit?html,css,output">clear</a>.
<!-- Make sure http://jsbin.com/qececaqilo/edit?html,css,output is clearly defined. -->
</ul>
The UA may <em>additionally</em> include
the margin areas of boxes for which it is the containing block.
The conditions under which such margin areas are included is undefined in this level.
<span class="issue">This needs further testing and investigation; is therefore deferred in this draft.</span>
<!--
Considerations:
* floats
* relpos
* margins that collapsed through to the edge of the scrollable area
* inline-side margins on both blocks and inlines
Notes:
The reasoning for only including border boxes is to minimize the cases
in which overflow scrolling is triggered; however once overflow is triggered,
excluding margins creates tight, uncomfortable edges
because the margin has been effectively truncated.
Testcase:
http://software.hixie.ch/utilities/js/live-dom-viewer/?%3C!DOCTYPE%20html%3E%0A%3Cstyle%3E%0A%20%20div%20%7B%20height%3A%2050px%3B%20overflow%3A%20scroll%3B%20border%3A%20solid%3B%20position%3A%20relative%3B%7D%0A%20%20p%20%7B%20margin%3A%2025px%3B%20background%3A%20red%3B%20%7D%0A%20%20q%20%7B%20position%3A%20absolute%3B%20background%3A%20blue%3B%20top%3A%2025px%3B%20margin%3A%2025px%3B%20%7D%0A%3C%2Fstyle%3E%0A%3Cdiv%3E%0A%20%20%3Cp%3ETest%20%3Cq%3ETest2%0A%3C%2Fdiv%3E
-->
Note: The <a>scrollable overflow rectangle</a> is always a rectangle
in the box's own coordinate system, but might be non-rectangular
in other coordinate systems due to transforms [[CSS3-TRANSFORMS]].
This means scrollbars can sometimes appear when not actually necessary.
<!--
███████ ██ ██ ████████ ████████ ████████ ██ ███████ ██ ██
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
██ ██ ██ ██ ██████ ████████ ██████ ██ ██ ██ ██ ██ ██ ███████ █████████
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
███████ ███ ████████ ██ ██ ██ ████████ ███████ ███ ███
-->
<h2 id="overflow-properties">
Scrolling and Clipping Overflow: the 'overflow-x', 'overflow-y', and 'overflow' properties</h2>
These properties specify whether a box’s content
(including any <a>ink overflow</a>)
is clipped to its padding edge,
and if so,
whether it is a <dfn export>scroll container</dfn>
that allows the user to scroll clipped parts of its <a>scrollable overflow region</a>
into view.
The visual viewport of the <a>scroll container</a>
(through which the <a>scrollable overflow region</a> can be viewed)
coincides with its padding box,
and is called the <dfn export>scrollport</dfn>.
<pre class=propdef>
Name: overflow-x, overflow-y
Value: ''visible'' | ''hidden'' | ''clip'' | ''scroll'' | ''auto''
Initial: ''visible''
Applies to: block containers [[!CSS21]], flex containers [[!CSS3-FLEXBOX]], and grid containers [[!CSS3-GRID-LAYOUT]]
Inherited: no
Percentages: N/A
Media: visual
Computed value: as specified, except with ''visible''/''clip'' computing to ''auto''/''hidden'' (respectively) if one of 'overflow-x' or 'overflow-y' is neither ''visible'' nor ''clip''
Animatable: no
</pre>
The 'overflow-x' property specifies
the handling of <a>overflow</a> in the horizontal direction
(i.e., overflow from the left and right sides of the box),
and the 'overflow-y' property specifies the handling
of <a>overflow</a> in the vertical direction
(i.e., overflow from the top and bottom sides of the box).
<pre class=propdef>
Name: overflow
Value: ''visible'' | ''hidden'' | ''clip'' | ''scroll'' | ''auto''
Initial: see individual properties
Applies to: block containers [[!CSS21]], flex containers [[!CSS3-FLEXBOX]], and grid containers [[!CSS3-GRID-LAYOUT]]
Inherited: no
Percentages: N/A
Media: visual
Computed value: see individual properties
Animatable: no
Canonical order: <abbr title="follows order of property value definition">per grammar</abbr>
</pre>
The 'overflow' property is a shorthand property
that sets the specified values of both 'overflow-x' and 'overflow-y'
to the value specified for 'overflow'.
Values have the following meanings:
<dl dfn-for="overflow, overflow-x, overflow-y" dfn-type="value">
<dt><dfn>visible</dfn>
<dd>
There is no special handling of overflow, that is,
the box’s content is rendered outside the box if positioned there.
The box is not a <a>scroll container</a>.
<dt><dfn>hidden</dfn>
<dd>
This value indicates that
the box’s content is clipped to its padding box
and that the UA must not provide any scrolling user interface
to view the content outside the clipping region,
nor allow scrolling by direct intervention of the user,
such as dragging on a touch screen
or using the scrolling wheel on a mouse.
However, the content must still be scrollable programatically,
for example using the mechanisms defined in [[CSSOM-VIEW]],
and the box is therefore still a <a>scroll container</a>.
<dt><dfn>clip</dfn>
<dd>
Like ''hidden'',
this value indicates that
the box’s content is clipped to its padding box
and that no scrolling user interface should be provided by the UA
to view the content outside the clipping region.
In addition, unlike ''overflow: hidden''
which still allows programmatic scrolling,
''overflow: clip'' forbids scrolling entirely,
through any mechanism,
and therefore the box is not a <a>scroll container</a>.
<dt><dfn>scroll</dfn>
<dd>
This value indicates that
the content is clipped to the padding box,
but can be scrolled into view
(and therefore the box is a <a>scroll container</a>).
Furthermore, if the user agent uses a scrolling mechanism
that is visible on the screen (such as a scroll bar or a panner),
that mechanism should be displayed
whether or not any of its content is clipped.
This avoids any problem with scrollbars appearing
and disappearing in a dynamic environment.
When the target medium is ''print'',
overflowing content may be printed;
it is not defined where it may be printed.
<dt><dfn>auto</dfn>
<dd>
Like ''overflow/scroll'' when the box has <a>scrollable overflow</a>;
like ''overflow/hidden'' otherwise.
Thus, if the user agent uses a scrolling mechanism
that is visible on the screen (such as a scroll bar or a panner),
that mechanism will only be displayed
if there is overflow.
</dl>
If the computed value of 'overflow' on a <a>block box</a>
is not ''overflow/visible'',
it creates a new <a>block formatting context</a> for its content.
<h3 id="static-media">
Overflow in Print and Other Static Media</h3>
<p class="advisement">
Since scrolling is not possible in static media
(such as print)
authors should be careful to make content accessible in such media,
for example by using ''@media print, (update: none) { … }''
to adjust layout such that all relevant content
is simultaneously visible.
On <a>scroll containers</a> in <a>static media</a>
with an 'overflow' value of ''overflow/auto'' or ''overflow/scroll''
(but not ''overflow/hidden'')
UAs may display an indication of any scrollable overflow,
such as by displaying scrollbars
or an ellipsis.
Note: Not all <a>paged media</a> is <a lt="static media">static</a>;
for example, e-book readers page content,
but are <a lt="interactive media">interactive</a>.
<h3 id="scrollbar-layout">
Scrollbars and Layout</h3>
In the case of a scrollbar being placed on an edge of the element's box,
it should be inserted between the inner border edge
and the outer padding edge.
Any space taken up by the scrollbars should be
taken out of (subtracted from the dimensions of)
the containing block formed by the element with the scrollbars.
Issue: import examples from [[CSS3-BOX]].
<h3 id="scrolling-direction">
Scrolling Origin, Direction, and Restriction</h3>
The <dfn export>initial scroll position</dfn>,
that is, the initial position of
the box’s <a>scrollable overflow region</a>
with respect to its border box,
prior to any user or programmatic scrolling that changes it,
is dependent on the box’s <a>writing mode</a>,
and is by default the <a>block-start</a>/<a>inline-start</a> edge
of the box’s <a>padding edge</a>.
However, the 'align-content' and 'justify-content' properties [[!CSS-ALIGN-3]]
can be used to change this,
see [[css-align-3#overflow-scroll-position]].
Due to Web-compatibility constraints
(caused by authors exploiting legacy bugs to surreptitiously hide content from visual readers but not search engines and/or speech output),
UAs must clip the <a>scrollable overflow region</a>
of <a>scroll containers</a>
on the <a>block-start</a> and </a>inline-start</a> sides of the box
(thereby behaving as if they had no <a>scrollable overflow</a> on that side).
The viewport uses the <a>principal writing mode</a> for these calculations.
<h3 id="overflow-propagation">
Overflow Viewport Propagation</h3>
UAs must apply the 'overflow-*' values
set on the root element to the <a>viewport</a>.
However,
when the root element is an [[!HTML]] <{html}> element
(including <a href="https://html.spec.whatwg.org/multipage/introduction.html#html-vs-xhtml">XML syntax for HTML</a>)
whose 'overflow' value is ''overflow/visible'' (in both axes),
and that element has a <{body}> element as a child,
user agents must instead apply the 'overflow-*' values
of the first such child element to the viewport.
The element from which the value is propagated must then have
a used 'overflow' value of ''overflow/visible''.
If ''overflow/visible'' is applied to the viewport,
it must be interpreted as ''overflow/auto''.
<h2 id="max-lines">
Limiting Visible Lines: the 'max-lines' property</h2>
<pre class=propdef>
Name: max-lines
Value: none | <<integer>>
Initial: none
Applies to: <a>block containers</a> (excluding <a>multi-column containers</a>)
Inherited: no
Animatable: as integer
Percentages: N/A
Media: visual
Computed value: specified value
</pre>
This property allows limiting the contents of a block container
to the specified number of lines;
remaining content is fragmented away
and neither rendered nor measured.
Specifically,
if the value of 'max-lines' is not <dfn for=max-lines type=value>none</dfn>:
<ul>
<li>The box becomes a <a>fragmentation container</a>
that captures <a>region breaks</a>,
if it is not already.
[[!CSS-BREAK-3]]
<li>A <a>region break</a>
is forced after its <var>N</var>th
descendant <a>in-flow</a> <a>line box</a>,
where <var>N</var> is the specified value of 'max-lines'.
The contents of descendants that are <a>scroll containers</a>
or that are not <a>block containers</a>
are skipped over while counting line boxes.
If fewer than <var>N</var> line boxes exist,
then 'max-lines' introduces no <a>region break</a>.
<li>The position of the first forced <a>region break</a>
(whether imposed by 'max-lines' or by another mechanism,
such as the 'break-before'/'break-after' properties)
is treated as the end of the <a>fragmentation container</a>,
and the rest of the <a>fragmented flow</a> is laid out in
the next <a>fragmentation container</a> in the <a>fragmentation context</a>.
If there is no subsequent <a>fragmentation container</a>
(which is the case if the box became a <a>fragmentation container</a>
merely as a consequence of applying the 'max-lines' property),
the rest of the <a>fragmented flow</a> is discarded,
similar to if it were ''display: none'':
it is neither rendered,
nor measured as part of the box’s contents for the purpose of
finding its <a lt="min-content block size">min-content</a>, <a>max-content</a>, or <a lt="automatic size">automatic</a> <a>block sizes</a>,
nor does allow user interaction.
However, since intrinsic sizes are calculated across all <a>fragmentation containers</a>,
this content <em>is</em> taken into account
for the purpose of finding the box’s
<a lt="min-content inline size">min-content</a> and <a>max-content</a> <a>inline sizes</a>
(see [[css-break-3#varying-size-boxes]]).
Note: In the case of <a href="https://www.w3.org/TR/css-break-3/#parallel-flows">parallel fragmentation flows</a>,
content occuring after the <a>fragmentation break</a> in the box tree
could still be rendered,
if it is laid out above the position
representing the end of this <a>fragmentation container</a>.
<!-- Honoring forced breaks from other sources
is to handle future use cases,
such as using 'max-lines' to size the first region
in a two-region section,
where the first region is for styling the first N lines of the article
differently from the rest. -->
</ul>
Only positive integers are accepted.
Zero or negative integers are invalid
and must cause the declaration to be <a>ignored</a>.
Note: The 'widows', 'orphans', and 'break-inside' properties
do not affect the position of the forced <a>region break</a>
introduced by the 'max-lines' property.
<h2 id="block-ellipsis">
Indicating Block-Axis Overflow: the 'block-overflow' property</h2>
ISSUE: This section is an unofficial draft, posted here for discussion.
See <a href="https://github.com/w3c/csswg-drafts/issues/390">issue</a>.
<pre class=propdef>
Name: block-overflow
Value: clip | ellipsis | <<string>>
Initial: clip
Applies to: <a>block containers</a>
Inherited: yes
Animatable: no
Percentages: N/A
Media: visual
Computed value: specified value
</pre>
This property allows inserting content into the last line box
before a (forced <em>or</em> unforced) <a>region break</a>
to indicate the continuity of truncated/interrupted content.
It only affects line boxes contained directly by the <a>block container</a> itself,
but as it inherits, will have an effect on descendants’ line boxes unless overridden.
If the box contains no line box immediately preceding a <a>region break</a>,
then this property has no effect.
ISSUE: Should this apply to other types of fragmentation breaks (e.g. pages, columns)?
The inserted content is called the <dfn>block overflow ellipsis</dfn>.
Values have the following meanings:
<dl dfn-for="block-overflow" dfn-type=value>
<dt><dfn>clip</dfn>
<dd>
The content is not altered.
<dt><dfn>ellipsis</dfn>
<dd>
Render an ellipsis character (U+2026)--
or a more typographically-appropriate equivalent--
as the <a>block overflow ellipsis</a>
at the end of the affected line box.
UAs should use the conventions of the
<a>content language</a>,
writing system, and
<a>writing mode</a>
to determine the most appropriate ellipsis string.
<dt><dfn><<string>></dfn>
<dd>
Render the specified string
as the <a>block overflow ellipsis</a>
at the end of the affected line box.
The UA may truncate this string if it is absurdly long.
</dl>
<div class="example">
In this example, the lead paragraph of each article
is listed in a shortened menu,
truncated to fit within 10 lines
that end with “… (continued on next page)”:
<xmp highlight=css>
li {
max-lines: 5;
block-overflow: "… (continued on next page)";
}
strong {
display: block;
text-transform: uppercase;
}
</xmp>
<xmp highlight=markup>
<li><a href="cheese-is-milk">
<strong>Cheese is Actually Made of Milk!</strong>
Investigative reporters at the World Wide Web Press Corps
have discovered the secret of cheese.
Tracing through byzantine layers of bureacracy and shadow corporations,
our crack team of journalists have traced the source of camembert.
</a></li>
</xmp>
Sample rendering:
<pre class="figure">
+---------------------------------------+
| CHEESE IS ACTUALLY MADE OF MILK! |
| Investigative reporters at the World |
| Wide Web Press Corps have discovered |
| the secret of cheese. Tracing through |
| byzantine… (continued on next page) |
+---------------------------------------+
</pre>
</div>
When 'block-overflow' is not ''block-overflow/clip'',
the <a>block overflow ellipsis</a> string
is wrapped in an anonymous inline
and placed at the end of the line box
as a direct child of the <a>block container</a>’s <a>root inline box</a>,
reducing the space in the line box
available to the other contents of the line.
This inline is assigned ''unicode-bidi: plaintext''
and is placed in the line box after the last
<a>soft wrap opportunity</a> [[!CSS-TEXT-3]]
that would still allow the entire <a>block overflow ellipsis</a> to fit on the line.
(This can result in the entire contents of the line box being replaced.)
For this purpose, <a>soft wrap opportunities</a> added by 'overflow-wrap' are ignored.
Text <a href="https://www.w3.org/TR/css-text-3/#justification">alignment and justification</a>
occurs after placement,
and measures the inserted <a>block overflow ellipsis</a>
together with the rest of the line’s content.
If there is no next <a>fragmentation container</a>
and thus the remainder of the content after the break would be discarded,
then the UA may visually replace the contents of the line,
as it does for 'text-overflow'.
If, however, there is a next <a>fragmentation container</a>
that would receive subsequent content,
then the content replaced by the <a>block overflow ellipsis</a>
must be pushed to the next <a>fragmentation container</a>
and the <a>block overflow ellipsis</a> inserted and laid out
exactly as if it were part of the <a>in-flow</a> contents of the line.
This can result in changes to layout within or impacted by the line.
The means of breaking any resulting cycles is up to the UA.
If the <a>block overflow ellipsis</a>
is too long to fit in the line,
the result is undefined.
(The UA may, for example, treat the <a>block overflow ellipsis</a> as an unbreakable string,
or it may lay out the string across more than one line,
replacing content in earlier lines as well.)
The <a>block overflow ellipsis</a> does not capture events:
pointer events are dispatched to whatever is underneath
or otherwise visually replaced by it.
It also has no effect on the intrinsic size of the box:
its <a lt="min-content size">min-content</a> and <a lt="max-content size">max-content</a> sizes
are calculated exactly as if 'block-overflow' were ''block-overflow/clip''.
Note: Future specifications may extend this feature,
for example by providing an ''::ellipsis'' pseudo-element
to style the text,
or by allowing the selection of a child element of the block
to use as either an inline-level or block-level indicator
(in which case, it can capture events).
<h2 id=line-clamp>
Setting 'max-lines' and 'block-overflow' together: the 'line-clamp' property</h2>
<pre class=propdef>
Name: line-clamp
Value: none | <<integer>>
Initial: none
Applies to: see individual properties
Inherited: see individual properties
Animatable: see individual properties
Percentages: N/A
Media: visual
Computed value: see individual properties
</pre>
The 'line-clamp' property is a <a>shorthand</a>
for the 'max-lines' and 'block-overflow' properties.
<dl dfn-for=line-clamp dfn-type=value>
<dt><dfn>none</dfn>
<dd>Sets 'max-lines' to ''max-lines/none''
and 'block-overflow' to ''block-overflow/clip''.
<dt><dfn><<integer>></dfn>
<dd>Sets 'max-lines' to the specified <<integer>>
and 'block-overflow' to ''block-overflow/ellipsis''.
</dl>
For compatibility with legacy content, UAs that support 'line-clamp' must also support <dfn dfn-type=property>-webkit-line-clamp</dfn> as an alias.
Privacy and Security Considerations {#priv-sec}
===============================================
This specification introduces no new privacy or security concerns.
<h2 class=no-num id="acknowledgments">
Acknowledgments</h2>
<p>
Thanks especially to the feedback from
Rossen Atanassov,
Bert Bos,
Tantek Çelik,
John Daggett,
Daniel Glazman,
Vincent Hardy,
Håkon Wium Lie,
Peter Linss,
Robert O'Callahan,
Florian Rivoal,
Alan Stearns,
Steve Zilles,
and all the rest of the
<a href="http://lists.w3.org/Archives/Public/www-style/">www-style</a> community.