-
Notifications
You must be signed in to change notification settings - Fork 708
/
Copy pathExclusions.src.html
1988 lines (1769 loc) · 79.4 KB
/
Exclusions.src.html
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 http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>CSS Exclusions and Shapes Module Level 3</title>
<link rel="stylesheet" type="text/css" href="../shared/style/default.css" />
<script src='https://test.csswg.org/harness/annotate.js#CSS3-EXCLUSIONS_DEV' type='text/javascript' defer></script>
<style type="text/css">
.singleImgExample {
display: block;
margin: auto;
}
.example-table {
table-layout: fixed;
width: 100%;
}
.example-table tr td img {
width: 90%;
}
</style>
<link rel="stylesheet" type="text/css"
href="https://www.w3.org/StyleSheets/TR/W3C-ED.css">
<link rel="stylesheet" type="text/css"
href="../shared/style/issues.css">
<link id="st" href="../shared/style/alternate-spec-style.css" rel="stylesheet"
type="text/css" title="alternate spec style">
</head>
<body>
<div id="div-head" class="head">
<p><a href="http://www.w3.org/"><img id="mobile-logo" alt="W3C" height="53" src=
"https://www.w3.org/2008/site/images/logo-w3c-mobile-lg" width="90"></a>
<!--begin-logo-->
<p><a href="http://www.w3.org/"><img id="logo" alt="W3C" height="48" src=
"https://www.w3.org/Icons/w3c_home" width="72"></a> <!--end-logo--></p>
<h1 id="css-exclusions-module">CSS Exclusions and Shapes Module Level 3</h1>
<h2 class="no-num no-toc">[LONGSTATUS] [DATE]</h2>
<dl>
<dt>This version:</dt>
<dd><a href="https://drafts.csswg.org/css3-exclusions/">https://drafts.csswg.org/css3-exclusions/</a></dd>
<!--<dd><a href="[VERSION]">https://www.w3.org/TR/[YEAR]/WD-css3-exclusions-[CDATE]/</a></dd>-->
<dt>Latest version:</dt>
<dd><a href="https://www.w3.org/TR/[SHORTNAME]/">https://www.w3.org/TR/[SHORTNAME]/</a></dd>
<dt>Editor's Draft:</dt>
<dd><a href="https://drafts.csswg.org/[SHORTNAME]/">https://drafts.csswg.org/[SHORTNAME]/</a>
<dt>Previous version:</dt>
<dd>None</dd>
<dt>Editors:</dt>
<dd class="vcard"><span class="fn">Vincent Hardy</span>, <span class="org">Adobe Systems, Inc.</span>, <span class="email">vhardy@adobe.com</span></dd>
<dd class="vcard"><span class="fn">Rossen Atanassov</span>, <span class="org">Microsoft Corporation</span>, <span class="email">ratan@microsoft.com</span></dd>
<dd class="vcard"><span class="fn">Alan Stearns</span>, <span class="org">Adobe Systems, Inc.</span>, <span class="email">stearns@adobe.com</span></dd>
<dt>Issues List:</dt>
<dd><a href="https://www.w3.org/Bugs/Public/buglist.cgi?query_format=advanced&product=CSS&component=Exclusions&resolution=---&cmdtype=doit">in Bugzilla</a></dd>
<dt>Feedback:</dt>
<dd><a href="mailto:www-style@w3.org?subject=%5B[css-exclusions]%5D%20feedback"
>www-style@w3.org</a>
with subject line “<kbd>[css-exclusions]
<var>… message topic …</var></kbd>”
(<a rel="discussion" href="http://lists.w3.org/Archives/Public/www-style/"
>archives</a>)
</dl>
<!--copyright-->
<hr title="Separator for header">
</div>
<h2 class="no-num no-toc" id="abstract">Abstract</h2>
<p>
CSS Exclusions define arbitrary areas around which <a href="https://www.w3.org/TR/CSS2/visuren.html#inline-boxes">inline content</a> ([[!CSS21]]) content can flow.
CSS Exclusions can be defined on any CSS block-level elements. CSS
Exclusions extend the notion of content wrapping previously limited to
floats.</p>
<p>CSS Shapes control the geometric shapes used for wrapping inline flow
content outside or inside an element. CSS Shapes can be applied to any
element. A circle shape on a float will cause inline content to wrap around
the circle shape instead of the float's bounding box.</p>
<p>Combining CSS Exclusions and CSS Shapes allows sophisticated layouts,
allowing interactions between shapes in complex positioning schemes.</p>
<h2 class="no-num no-toc" id="status">Status of this document</h2>
<!--status-->
<h2 class="no-num no-toc" id="contents">Table of contents</h2>
<!--toc-->
<h2 id="intro">Introduction</h2>
<p><em>This section is not normative.</em></p>
<p>
The exclusions section of this specification defines features that allow inline flow
content to wrap around outside the <span>exclusion area</span> of elements.
</p>
<p>
The shapes section of the specification defines properties to control the geometry of
an element's <span>exclusion area</span> as well as the geometry used for wrapping
an element's inline flow content.
</p>
<h2 id="definitions">Definitions</h2>
<dfn>Exclusion box</dfn>
<p>
A <a href="https://www.w3.org/TR/css3-box/">box</a> ([[!CSS3BOX]]) that defines an <span>exclusion area</span> for other boxes. The 'wrap-flow'
property is used to make an element's generated box an exclusion box. An exclusion box contributes
its <span>exclusion area</span> to its <a href="https://www.w3.org/TR/CSS2/visudet.html#containing-block-details">
containing block's</a> <span>wrapping context</span>. An element with a 'float'
computed value other than 'none' does not become an exclusion.
</p>
<dfn>Exclusion area</dfn>
<p>
The area used for excluding inline flow content around an exclusion box. The
<span>exclusion area</span> is equivalent to the <a href="https://www.w3.org/TR/CSS2/box.html#box-dimensions">
border box</a> for an exclusion box.
This specification's
'shape-outside' property
can be used to define arbitrary,
non-rectangular <span>exclusion areas</span>.
The 'shape-inside' property also defines an <span>exclusion area</span>,
but in this case it is the area outside the shape that inline content avoids.
</p>
<dfn>Float area</dfn>
<p>
The area used for excluding inline flow content around a float element. By default, the
float area is the float element's
<a href="https://www.w3.org/TR/CSS2/box.html#box-dimensions">margin box</a>.
This specification's
'shape-outside' property can be used to define arbitrary, non-rectangular float
areas.
</p>
<dfn>Exclusion element</dfn>
<p>An block-level element which is not a float and generates an <span>exclusion box</span>.
An element generates an exclusion box when its 'wrap-flow' property's computed value is not 'auto'.
</p>
<dfn>Wrapping context</dfn>
<div class="issue-marker" data-bug_id="15086" data-bug_status="NEW">
<a href="https://www.w3.org/Bugs/Public/show_bug.cgi?id=15086">Issue-15086</a>
<div class="issue-details">
<p class="short-desc">should the wrapping context be generic and include floats?</p>
</div>
</div>
<p>
The <span>wrapping context</span> of a box is a collection of <span>exclusion areas</span>
contributed by its associated <span>exclusion boxes</span> and elements with 'shape-inside'. During layout,
a box wraps its inline flow content in the <code>wrapping area</code> that corresponds to the subtraction of
its <span>wrapping context</span> from its own <span>content area</span>.
</p>
<p>
A box inherits its
<a href="https://www.w3.org/TR/CSS2/visudet.html#containing-block-details">containing block's</a>
<span>wrapping context</span> unless it specifically
resets it using the 'wrap-through' property.
</p>
<dfn>Content area</dfn>
<p>
The <a href="https://www.w3.org/TR/CSS2/box.html#box-dimensions">content area</a>
is normally used for layout of the inline flow content of a box.
</p>
<dfn>Wrapping area</dfn>
<p>
The area used for layout of inline flow content of a box affected by a <span>wrapping context</span>, defined by subtracting the <span>wrapping context</span> from its <span>content area</span>
</p>
<div class="issue-marker" data-bug_id="15089" data-bug_status="NEW">
<a href="https://www.w3.org/Bugs/Public/show_bug.cgi?id=15089">Issue-15089</a>
<div class="issue-details">
<p class="short-desc">shrink-to-fit circle / shape</p>
</div>
</div>
<dfn title="outside-inside">Outside and inside</dfn>
<p>
In this specification, 'outside' refers to DOM content that is not a descendant of an element
while 'inside' refers to the element's descendants.
</p>
<h2 id="exclusions">Exclusions</h2>
<p>
Exclusion elements define <span>exclusion areas</span> that contribute to their containing block's
<span>wrapping context</span>. As a consequence, exclusions impact the layout of their
containing block's descendants.
<p>
<p>
Elements layout their inline content in their <span>content area</span> and wrap around the
<span>exclusion areas</span> in their associated <span>wrapping context</span>. If the element is itself an exclusion, it
does not wrap around its own exclusion shape and the impact of other exclusions on other
exclusions is controlled by the 'z-index' property as explained in the
<a href="#exclusions-order">exclusions order</a> section.
</p>
The <a href="#shapes">shape properties</a> can be used to change the shape of
<span>exclusion areas</span>.
</p>
<h3 id="declaring-exclusions">Declaring exclusions</h3>
<p>
An element becomes an exclusion when its 'wrap-flow' property has a computed value other than
'auto'.
</p>
<h4 id="wrap-flow-property">The 'wrap-flow' property</h4>
<table class="propdef">
<tr>
<th>Name:</th>
<td><dfn title="'wrap-flow'">wrap-flow</dfn></td>
</tr>
<tr>
<th>Value:</th>
<td><var>auto</var> | <var>both</var> | <var>start</var> | <var>end</var> | <var>minimum</var> | <var>maximum</var> | <var>clear</var></td>
</tr>
<tr>
<th>Initial:</th>
<td>auto</td>
</tr>
<tr>
<th>Applies to:</th>
<td>block-level elements.</td>
</tr>
<tr>
<th>Inherited:</th>
<td>no</td>
</tr>
<tr>
<th>Percentages:</th>
<td>N/A</td>
</tr>
<tr>
<th>Computed value:</th>
<td>as specified except for element's whose 'float' computed value is not
<code class="css">none</code>, in which case the computed value is 'auto'.</td>
</tr>
</table>
<p>The values of this property have the following meanings:</p>
<dl>
<dt><dfn title="'wrap-flow'!!'auto'">auto</dfn></dt>
<dd>
No exclusion is created. Inline flow content interacts with the element as usual.
In particular, if the element is a
<a href="https://www.w3.org/TR/CSS2/visuren.html#floats">float</a> (see [[CSS21]]), the
behavior is unchanged.
</dd>
<dt><dfn title="'wrap-flow'!!'both'">both</dfn></dt>
<dd>
Inline flow content can flow on all sides of the exclusion.
</dd>
<dt><dfn title="'wrap-flow'!!'start'">start</dfn></dt>
<dd>
Inline flow content can flow
around the start edge
of the <span>exclusion area</span>
but must leave the area
next to the end edge
of the exclusion empty.
</dd>
<dt><dfn title="'wrap-flow'!!'end'">end</dfn></dt>
<dd>
Inline flow content can flow
around the end edge
of the <span>exclusion area</span>
but must leave the area
next to the start edge
of the exclusion empty.
</dd>
<dt><dfn title="'wrap-flow'!!'minimum'">minimum</dfn></dt>
<dd>
Inline flow content can flow
around the edge of the exclusion
with the smallest available space
within the flow content's containing block,
and must leave the other edge
of the exclusion empty.
</dd>
<dt><dfn title="'wrap-flow'!!'maximum'">maximum</dfn></dt>
<dd>
Inline flow content can flow
around the edge of the exclusion
with the largest available space
within the flow content's containing block,
and must leave the other edge
of the exclusion empty.
</dd>
<dt><dfn title="'wrap-flow'!!'clear'">clear</dfn></dt>
<dd>
Inline flow content can only flow
before and after the exclusion
in the flow content's block direction
and must leave the areas
next to the start and end edges
of the exclusion empty.
</dd>
</dl>
<p>
If the property's computed value is 'auto', the element does not become an
<span>exclusion</span>.
</p>
<p>
Otherwise, a computed 'wrap-flow' property value of 'both', 'start', 'end', 'minimum',
'maximum' or 'clear' on an element makes that element an <span>exclusion element</a>.
It's <span>exclusion shape</span> is contributed to its containing block's
<span>wrapping context</span>, causing the containing block's descendants to wrap around
its <span>exclusion area</span>.
</p>
<div class="figure">
<img alt="LTR text wrapping on left edge, RTL text wrapping on right edge, and vertical text wrapping on top edge." src="images/exclusion-writing-modes.png" width="70%" />
<p class="caption">Exclusion with 'wrap-flow: start' interacting with various writing modes.</p>
</div>
<p>Determining the relevant edges of the exclusion depends on the <a href="https://www.w3.org/TR/css3-writing-modes/#text-flow">writing mode</a> [[!CSS3-WRITING-MODES]] of the content wrapping around the <span>exclusion area</span>.
<p>An <span>exclusion element</span> establishes a
new <a href="">block formatting context</a> (see [[!CSS21]]) for its content.</p>
<div class="figure">
<img alt="General illustration showing how exclusions combine" src="images/exclusions-illustration.png" width="70%" />
<p class="caption">Combining exclusions</p>
</div>
<p>
The above figure illustrates how exclusions are combined.
The outermost box represents an element's content box.
The A, B, C and D darker gray boxes represent exclusions
in the element's <span>wrapping context</span>.
A, B, C and D have their respective 'wrap-flow'
computed to 'both', 'start', 'end' and 'clear' respectively.
The lighter gray areas show the additional areas
that are excluded for inline layout
as a result of the 'wrap-flow' value.
For example, the area to the right of 'B'
cannot be used for inline layout
of left-to-right writing mode content
because the 'wrap-flow' for 'B' is 'start'.
</p>
<p>
The background 'blue' area shows what areas are available
for a left-to-right writing mode element's inline content layout.
All areas represented with a light or dark shade of gray
are not available for (left-to-right writing mode) inline content layout.
</p>
<div class="issue-marker wrapper">
<div class="issue-marker" data-bug_id="15084" data-bug_status="NEW">
<a href="https://www.w3.org/Bugs/Public/show_bug.cgi?id=15084">Issue-15084</a>
<div class="issue-details">
<p class="short-desc">Fluidity of the layout with respect to different amounts of content</p>
</div>
</div>
</div>
<div class="example">
<p>
The 'wrap-flow' property values applied to exclusions as grid items.
</p>
<code class="html"><pre>
<div id="grid">
<div id="top-right" class="exclusion"></div>
<div id="bottom-left" class="exclusion"></div>
<div id="content">Lorem ipsum…</div>
</div>
<style type="text/css">
#grid {
width: 30em;
height: 30em;
display: grid;
grid-columns: 25% 25% 25% 25%;
grid-rows: 25% 25% 25% 25%;
#top-right {
grid-column: 3;
grid-row: 2;
}
#bottom-left {
grid-column: 2;
grid-row: 3;
}
.exclusion {
wrap-flow: <see below>
}
#content {
grid-row: 1;
grid-row-span: 4;
grid-column: 1;
grid-column-span: 4;
}
</style>
</pre></code>
<p>The following figures illustrate the visual rendering for different values
of the 'wrap-flow' property. The gray grid lines are marking the grid cells. and the
blue area is the exclusion box (positioned by the grid).</p>
<table class="example-table">
<tr>
<td><code class="html">.exclusion{ wrap-flow: auto; }</code></td>
<td><code class="html">.exclusion{ wrap-flow: both; }</code></td>
</tr>
<tr>
<td><img src="images/exclusion_wrap_side_auto.png" alt="Example rendering for wrap-side: auto" /></td>
<td><img src="images/exclusion_wrap_side_both.png" alt="Example rendering for wrap-side: both" /></td>
</tr>
<tr>
<td><code class="html">.exclusion{ wrap-flow: start; }</code></td>
<td><code class="html">.exclusion{ wrap-flow: end; }</code></td>
</tr>
<tr>
<td><img src="images/exclusion_wrap_side_left.png" alt="Example rendering for wrap-side: start" /></td>
<td><img src="images/exclusion_wrap_side_right.png" alt="Example rendering for wrap-side: end" /></td>
</tr>
<tr>
<td><code class="html">.exclusion{ wrap-flow: minimum; }</code></td>
<td><code class="html">.exclusion{ wrap-flow: maximum; }</code></td>
</tr>
<tr>
<td><img src="images/exclusion_wrap_side_minimum.png" alt="Example rendering for wrap-side: minimum" /></td>
<td><img src="images/exclusion_wrap_side_maximum.png" alt="Example rendering for wrap-side: maximum" /></td>
</tr>
<tr>
<td><code class="html">.exclusion{ wrap-flow: clear; }</code></td>
<td></td>
</tr>
<tr>
<td><img src="images/exclusion_wrap_side_clear.png" alt="Example rendering for wrap-side: clear" /></td>
<td></td>
</tr>
</table>
</div>
<!-- End section "wrap-flow Property" -->
<!-- End section "Declaring Exclusions" -->
<h3 id="scope-and-effect-of-exclusions">Scope and effect of exclusions</h3>
<p>
An <span>exclusion</span> affects
the inline flow content descended
from the exclusion's containing block
(defined in <a href="https://www.w3.org/TR/CSS2/visudet.html#containing-block-details">
CSS 2.1 10.1</a>)
and that of all descendant elements
of the same containing block.
All inline flow content
inside the containing block
of the exclusions is affected.
To stop the effect of exclusions
defined outside an element,
the 'wrap-through' property can be used
(see the <a href="#propagation-of-exclusions">propagation of exclusions</a>
section below).
</p>
<p>
As a reminder,
for exclusions with 'position:fixed',
the containing block is that
of the root element.
</p>
<!-- End section "Scope and Effect of Exclusions" -->
<h3 id="propagation-of-exclusions">Propagation of Exclusions</h3>
<p>
By default, an element inherits its parent <span>wrapping context</span>. In other words
it is subject to the exclusions defined <span title="outside-inside">outside</sapn> the element.
</p>
<p>Setting the 'wrap-through' property to 'none' prevents an element from inheriting its parent
<span>wrapping context</span>. In other words, exclusions defined 'outside' the element, have not effect
on the element's children layout.
</p>
<div class="note">
Exclusions defined by an element's descendants still contribute to their containing block's
<span>wrapping context</span>. If that containing block is a child of an element with 'wrap-through'
computes to none, or the element itself, then exclusion still have an effect on the children of that
containing block element.
</div>
<h4 id="wrap-through-property">The 'wrap-through' Property</h4>
<table class="propdef">
<tr>
<th>Name:</th>
<td><dfn title="'wrap-through'">wrap-through</dfn></td>
</tr>
<tr>
<th>Value:</th>
<td><var>wrap</var> | <var>none</var></td>
</tr>
<tr>
<th>Initial:</th>
<td>wrap</td>
</tr>
<tr>
<th>Applies to:</th>
<td>block-level elements</td>
</tr>
<tr>
<th>Inherited:</th>
<td>no</td>
</tr>
<tr>
<th>Percentages:</th>
<td>N/A</td>
</tr>
<tr>
<th>Computed value:</th>
<td>as specified</td>
</tr>
</table>
<p>The values of this property have the following meanings:</p>
<dl>
<dt><dfn title="'wrap-through'!!'wrap'">wrap</dfn></dt>
<dd>
The element inherits its parent node's <span>wrapping context</span>. Its descendant
inline content wraps around exclusions defined <span title="outside-inside">outside</span>
the element.
</dd>
</dl>
<dl>
<dt><dfn title="'wrap-through'!!'none'">none</dfn></dt>
<dd>
The element does not inherit its parent node's <span>wrapping context</span>. Its
descendants are only subject to exclusion shapes defined <span title="outside-inside">inside</span>
the element.
</dd>
</dl>
<div class="example">
<p>
Using the 'wrap-through' property to control the effect of exclusions.
</p>
<pre><code class="html">
<style type="text/css">
#grid {
display: grid;
grid-columns: 25% 50% 25%;
grid-rows: 25% 25% 25% 25%;
}
#exclusion {
grid-row: 2;
grid-row-span: 2;
grid-column: 2;
wrap-flow: <see below>
}
#rowA, #rowB {
grid-row-span: 2;
grid-column: 1;
grid-column-span: 3;
}
#rowA {
grid-row: 1;
}
#rowB {
grid-row: 3;
}
</style>
<style type="text/css">
.exclusion {
wrap-flow: both;
position: absolute;
left: 20%;
top: 20%;
width: 50%;
height: 50%;
background-color: rgba(220, 230, 242, 0.5);
}
</style>
<div id="grid">
<div class=”exclusion”></div>
<div id="rowA" style=”wrap-through: wrap;”> Lorem ipsum dolor sit amet...</div>
<div id="rowB" style=”wrap-through: none;”> Lorem ipsum dolor sit amet...</div>
</div>
</code></pre>
<img class="singleImgExample" src="images/exclusion_wrap_through.png" alt="Example rendering of wrap-through: wrap | none" style="max-width:40%"/>
</div>
<!-- End section "wrap-through property" -->
<!-- removed as wrap-margin and wrap-padding changed to shape-margin and shape-padding
<h4 id="wrap-shorthand-property">The 'wrap' Shorthand Property</h4>
<table class="propdef">
<tr>
<th>Name:</th>
<td><dfn title="'wrap'">wrap</dfn></td>
</tr>
<tr>
<th>Value:</th>
<td><var><wrap-flow></var> || <var><wrap-margin></var> [ / <var><wrap-padding></var>]</td>
</tr>
<tr>
<th>Initial:</th>
<td>see individual properties</td>
</tr>
<tr>
<th>Applies to:</th>
<td>block-level elements</td>
</tr>
<tr>
<th>Inherited:</th>
<td>no</td>
</tr>
<tr>
<th>Percentages:</th>
<td>N/A</td>
</tr>
<tr>
<th>Computed value:</th>
<td>see individual properties</td>
</tr>
</table>
<p>
The 'wrap' property is a shorthand property for setting the exclusions properties
at the same place in the style sheet.
</p>
-->
<!-- End section "wrap shorthand property" -->
<!-- End section "Propagation of Exclusions" -->
<h3 id="exclusions-order">Exclusions order</h3>
<p>
Exclusions follow the painting order (See [[!CSS21]] Appendix E). Exclusions are
applied in reverse to the document order in which they are defined. The last exclusion
appears on top of all other exclusion, thus it affects the inline flow content of
all other preceding exclusions or elements descendant of the same containing block.
The 'z-index' property can be used to change the ordering of
<a href="https://www.w3.org/TR/CSS2/visuren.html#choose-position">positioned</a> exclusion
boxes (see [[!CSS21]]). Statically positioned exclusions are not affected by the
'z-index' property and thus follow the painting order.
</p>
<div class="issue-marker" data-bug_id="16474" data-bug_status="NEW">
<a href="https://www.w3.org/Bugs/Public/show_bug.cgi?id=16474">Issue-16474</a>
<div class="issue-details">
<p class="short-desc">Improve Example 3 about exclusion order</p>
</div>
</div>
<div class="example">
<p>Ordering of exclusions.</p>
<pre><code class="html">
<style type="text/css">
.exclusion {
wrap-flow: both;
position: absolute;
width: 50%;
height: auto;
}
</style>
<div class=”exclusion” style=”top: 0px; left: 0px;”>
Lorem ipsum dolor sit amet...
</div>
<div id="orderedExclusion" class=”exclusion” style=”top: 25%; left: 25%;”>
Lorem ipsum dolor sit amet...
</div>
<div class=”exclusion” style=”top: 50%; left: 50%;”>
Lorem ipsum dolor sit amet...
</div>
</code></pre>
<table class="example-table">
<tr>
<td style="width:50%"><code class="html">#orderedExclusion{ z-index: auto; }</code></td>
<td style="width:50%"><code class="html">#orderedExclusion{ z-index: 1; }</code></td>
</tr>
<tr>
<td><img class="singleImgExample" src="images/exclusion_ordering.png" alt="Example rendering of default exclusion ordering." /></td>
<td><img class="singleImgExample" src="images/exclusion_ordering_z_order.png" alt="Example rendering of default exclusion ordering." /></td>
</tr>
</table>
</div>
<!-- End section "Order of Exclusions" -->
<div class="issue-marker wrapper">
<div class="issue-marker" data-bug_id="15183" data-bug_status="NEW">
<a href="https://www.w3.org/Bugs/Public/show_bug.cgi?id=15183">Issue-15183</a>
<div class="issue-details">
<p class="short-desc">Is the CSS exclusions processing model incorrect?</p>
</div>
</div>
</div>
<div class="issue">
<p>The current draft provides a model for exclusions
without a collision-avoidance model.
The existing exclusion model in CSS uses floats,
which have both exclusion and collision-avoidance behavior.
Concerns have been raised that allowing exclusions
without collision avoidance could be harmful,
particularly with absolutely-positioned elements.
Three options should be considered:<p>
<ol>
<li>Allow exclusions in positioning schemes
with no collision avoidance.</li>
<li>Disallow exclusions in positioning schemes
with no collision avoidance.</li>
<li>Define collision-avoidance behavior
for positioning schemes without it,
and use this behavior by default with exclusions.</li>
</ol>
</div>
<h3 id="exclusions-processing-model">Processing model</h3>
<h4 id="exclusions-processing-model-description">Description</h4>
<p>Applying exclusions is a two-step process:</p>
<ul>
<li><strong>Step 1</strong>: resolve exclusion boxes belonging to each <span>wrapping context</span></li>
<li><strong>Step 2</strong>: resolve <span>wrapping context</span>s and lay out each containing block in turn:
<ul>
<li><strong>Step 2-A</strong>: resolve the position and size of exclusion boxes</li>
<li><strong>Step 2-B</strong>: lay out containing block, wrapping around <span>exclusion areas</span></li>
</ul>
</li>
</ul>
<h4 id="step-1-resolve-exclusion-boxes-belonging-to-each-wrapping-context">Step 1: resolve exclusion boxes belonging to each <span>wrapping context</span></h4>
<p>In this step, the user agent determines which <a href="https://www.w3.org/TR/CSS2/visudet.html#containing-block-details">containing block</a> each
<span>exclusion area</span> belongs to. This is a simple step, based on the
definition of containing blocks and elements with a computed value for 'wrap-flow'
that is not <code class="css">auto</code>.</p>
<h4 id="step-2-resolve-wrapping-contexts-layout-containing-blocks">Step 2: resolve wrapping contexts and lay out containing blocks</h4>
<p>In this step, starting from the
top of the <a href="https://www.w3.org/TR/CSS2/visuren.html#z-index">rendering tree</a> (see [[!CSS21]]),
the agent processes each containing block in two sub-steps.</p>
<h4 id="step-2-A-resolve-exclusions-position-and-size">Step 2-A: resolve the position and size of exclusion boxes</h4>
<p>Resolving the position and size
of <span>exclusion boxes</span>
in the <span>wrapping context</span>
may or may not require a layout.
For example,
if an <span>exclusion box</span>
is absolutely positioned and sized,
a layout may not be needed
to resolve its position and size.
In other situations,
laying out the containing block's content is required.</p>
<p>When a layout is required,
it is carried out
without applying any <span>exclusion area</span>.
In other words,
the containing block is laid out
without a <span>wrapping context</span>. </p>
<p>Step 2-A yields a position and size
for all <span>exclusion boxes</span>
in the <span>wrapping context</span>.
Each exclusion box is processed in turn,
starting from the top-most,
and each <span>exclusion area</span>
is computed and contributed
to the <a href="https://www.w3.org/TR/CSS2/visudet.html#containing-block-details">containing block's</a>
<span>wrapping context</span>. </p>
<p>Scrolling is ignored in this step
when resolving the position and size
of 'position:fixed' <span>exclusion boxes</span>.</p>
<p>Once the <a href="https://www.w3.org/TR/CSS2/visudet.html#containing-block-details">containing block's</a>
<span>wrapping context</span> is computed,
all <span>exclusion boxes</span>
in that <span>wrapping context</span>
are removed from the normal flow.</p>
<h4 id="step-2-B-layout-containing-block-applying-wrapping">Step 2-B: lay out containing block applying wrapping</h4>
<p>Finally, the content
of the containing block is laid out,
with the inline content wrapping around
the <span>wrapping content</span>'s
<span>exclusion areas</span>
(which may be different
from the <span>exclusion box</span>
because of the 'shape-outside' property).</p>
<p>When the containing block itself is an <span>exclusion box</span>, then
rules on <a href="#exclusions-order">exclusions order</a> define which exclusions
affect the inline and descendant content of the box.</p>
<h4 id="exclusions-processing-model-example">Example</h4>
<p>This section illustrates the exclusions processing model with an example. It is meant
to be simple. Yet, it contains enough complexity to address the issues of
layout dependencies and re-layout.</p>
<p>The code snippet in the following example has two exclusions affecting
the document's inline content.</p>
<div class="example">
<pre class="html"><html>
<style>
#d1 {
position:relative;
height: auto;
color: #46A4E9;
border: 1px solid gray;
}
#e1 {
wrap-flow: both;
position: absolute;
left: 50%;
top: 50%;
width: 40%;
height: 40%;
border: 1px solid red;
margin-left: -20%;
margin-top: -20%;
}
#d2 {
position: static;
width: 100%;
height: auto;
color: #808080;
}
#e2 {
wrap-flow: both;
position: absolute;
right: 5ex;
top: 1em;
width: 12ex;
height: 10em;
border: 1px solid lime;
}
</style>
<body>
<div id="d1">
Lorem ipsusm ...
<p id="e1"></p>
</div>
<div id="d2">
Lorem ipsusm ...
<p id="e2" ></p>
</div>
</body>
</html></pre>
</div>
<p>The following figures illustrate:</p>
<ul>
<li>the document's DOM tree</li>
<li>the layout tree of generated block boxes</p>
</ul>
<div class="figure">
<img src="images/processing-model-example-dom.svg" width="200"
alt="DOM tree nodes"/>
<p class="caption">DOM tree</p>
</div>
<div class="figure">
<img src="images/processing-model-example-layout-tree.svg" width="350"
alt="Layout tree boxes"/>
<p class="caption">Layout tree of generated block boxes</p>
</div>
<h5>Step 1: resolve exclusion boxes belonging to each <span>wrapping context</span></h5>
<p>The figures illustrate how the boxes corresponding to the element sometimes
have a different containment hierarchy in the layout tree than in the DOM tree.
For example, the box generated by <code class="idl">e1</code> is positioned in
its containing block's box, which is the <code class="idl">d1-box</code>, because
<code class="idl">e1</code> is absolutely positioned and <code class="idl">d1</code>
is relatively positioned. However, while <code class="idl">e2</code> is also absolutely
positioned, its containing block is the initial containing block (ICB). See the
section 10.1 of the CSS 2.1 specification ([[!CSS21]]) for details.</p>
<p>As a result of the computation of containing blocks for the tree, the boxes belonging
to the <span>wrapping context</span>s of all the elements can be determined:</p>
<ul>
<li>The <span>wrapping context</span> for the html element contains the <code class="idl">e2</code> box: WC-1 (Wrapping Context 1)</li>
<li>The <span>wrapping context</span> for the body element inherits the html element's <span>wrapping context</span>: WC-1</li>
<li>The <span>wrapping context</span> for <code class="idl">d1</code> inherits the body element's
<span>wrapping context</span> and adds the <code class="idl">e1-box</code> to it. So the wrapping
context is made of both the <code class="idl">e1-box</code> and the
<code class="idl">e2-box</code>: WC-2</li>
<li>The <span>wrapping context</span> for <code class="idl">d2</code> inherits the body element's
<span>wrapping context</span>: WC-1</li>
</ul>
<h5>Step 2: resolve wrapping contexts and lay out containing blocks</h5>
<p>In this step, each containing block is processed in turn. For each containing block,
we (conceptually) go through two phases:</p>
<ol>
<li>resolve the <span>wrapping context</span>: resolve the position and size of its exclusions</li>
<li>lay out the containing block</li>
</ol>
<p>In our example, this breaks down to:</p>
<ol>
<li>resolve the position and size of the exclusions belonging to WC-1: RWC-1 (Resolved Wrapping Context 1).</li>
<li>lay out the initial containing block (i.e., lay out its content):
<ol>
<li>resolve the html element's <span>wrapping context</span>: RWC-1</li>
<li>lay out the html element:
<ol>
<li>resolve the body element's <span>wrapping context</span>: RWC-1</li>
<li>lay out the body element:
<ol>
<li>resolve the <code class="idl">d1</code> element's <span>wrapping context</span>: RWC-2</li>
<li>lay out the <code class="idl">d1</code> element</li>
<li>resolve the <code class="idl">d2</code> element's <span>wrapping context</span>: RWC-1</li>
<li>lay out the <code class="idl">d2</code> element</li>
</ol>
</li>
</ol>
</li>
</ol>
</li>
</ol>
<h6>Resolving RWC-1</h6>
<p>The top-most <span>wrapping context</span> in the layout tree contains the <code class="idl">e2</code>
exclusion. Its position and size needs to be resolved. In general, computing an
exclusion's position and size may or may not require laying out other content.
In our example, no content needs to be laid out to resolve the <code class="idl">e2</code>
exclusion's position because it is absolutely positioned and its size can be resolved
without layout either. At this point, RWC-1 is resolved and can be used when
laying inline content out.</p>
<h6>Resolving RWC-2</h6>
<p>The process is similar: the position of the
<code class="idl">e1</code> exclusion needs to be resolved. Again, resolving the exclusion's
position and size may require processing the containing block (d1 here).
It is the case here because the size and position of
<code class="idl">e1</code> depend on resolving the percentage lengths. The percentages are relative
to the size of
<code class="idl">d1</code>'s box. As a result, in order to resolve
a size for <code class="idl">d1</code>'s box, a first layout of <code class="idl">d1</code>
is done without any <span>wrapping context</span> (i.e., no exclusions applied). The layout yields a
position and size for <code class="idl">e1</code>'s box.
</p>
<p>At this point, RWC-2 is resolved because the position and size of both
e1 and e2 are resolved.</p>
<p class="note">The important aspect of the above processing example is that once an element's <span>wrapping context</span>
is resolved (by resolving its exclusions' position and size), the position and size of the
exclusions are not re-processed if the element's size changes between the layout that may be done
without considering any <span>wrapping context</span> (as for RWC-2) and the layout done with the resolved <span>wrapping context</span>.
This is what breaks the possible circular dependency between the resolution of <span>wrapping context</span>s