-
Notifications
You must be signed in to change notification settings - Fork 708
/
Copy pathOverview.bs
1160 lines (891 loc) · 35.7 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
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
<h1>CSS Page Floats</h1>
<pre class='metadata'>
Shortname: css-page-floats
Level: 3
Group: csswg
Status: ED
Work Status: Exploring
ED: http://dev.w3.org/csswg/css-page-floats/
Previous Version: https://hg.csswg.org/drafts/raw-file/108d7e3ff204/css-page-floats/Overview.html
Editor: Johannes Wilm, Vivliostyle, johanneswilm@vivliostyle.com
Former Editor: Håkon Wium Lie, Opera Software, howcome@opera.com
Abstract: This document describes floats that move to the top or bottom of content
Abstract: passages. This feature has traditionally been used in print
Abstract: publications in which figures and photos are moved to the top or bottom
Abstract: of columns or pages, along with their captions.
Abstract: This draft describes how to achieve this effects for floats within pages,
Abstract: columns, regions and elements.
Ignored Terms: near, 3em, intrude, top-corner, bottom-corner, left, right, both, element, none, floats, inline, max-width, max-height
</pre>
<h2 id="overview">Overview</h2>
<em>This section is not normative.</em>
This specification adds new keywords on the 'float' property.
This document allows to specify whether a <a>float</a> floats to align with a
<a>float reference</a> inline box, column, region or page. In the case of floats
with a reference 'fragmentation container', placement can be deferred to a
subsequent 'fragmentation container' with the <em>float-defer</em> properties.
New values on the 'clear' property add further ways of refining layouts.
The way contents wrap around floats can be controlled by changing the value of
the 'wrap-flow' property which initially is set to 'both' for page floats.
<p class="issue">
Page floats as defined here work with different types of fragmentation types
(columns, regions, pages) as well as container elements. The specification
is no longer specific to print or to pages.
At the same time, inline floats and page floats differ in many ways, and it may
(or may not) be a good idea to separate the two entirely.
Therefore, the name <em>CSS Page Floats</em> should probably be replaced with
a more appropriate name.
</div>
<h2 id="terms">
Terminology</h2>
<dl export>
<dt><dfn>Float</dfn>
<dd>
An element which has float set to something else than none.
<dt><dfn>Float block formatting context</dfn>
<dd>
The block formatting context which is generated by a float and which contains
its contents.
<dt><dfn>Float anchor</dfn>
<dd>
The float anchor is the point in the flow where the float had appeared had
it not been a float and instead had been an empty inline element with no
margins, borders or padding.
<dt><dfn>Float containing block formatting context</dfn>
<dd>
The block formatting context inside of which the float is embedded.
<dt><dfn>Initial float reference</dfn>
<dd>
The entity to which the float is aligned initially, before float
placement takes place.
<dt><dfn>Float reference</dfn>
<dd>
The entity to which the float is aligned.
</dl>
<h2 id="floating">
Floating to the inline-start/inline-end and block-start/block-end</h2>
<p>
Floating elements can float to the start or end of the <a>float anchor</a>'s line or
block, specified by the 'float' attribute. The floats are aligning to the start
or end of a <a>float reference</a>, specified by the 'float-reference' attribute. The
<a>float reference</a> can be the <a>float anchor</a>'s line box, column, region or page.
<h3 id="float-reference-property">The 'float-reference' property</h3>
<pre class="propdef">
Name: float-reference
Value: inline | column | region | page
Initial: inline
Applies to: all elements.
Inherited: no
Percentages: N/A
Media: visual
Computed value: as specified.
Animatable: no
</pre>
<dl dfn-for="float-reference" dfn-type="value">
<dt><dfn>inline</dfn>
<dd>
The <a>float reference</a> is the line box of the <a>float anchor</a>.
The <a>float containing block formatting context</a> is the same as that of the
<a>float anchor</a>.
<dt><dfn>column</dfn>
<dd>
The <a>float reference</a> is the column in a multi column environment in
which the <a>float anchor</a> is placed. If the <a>float anchor</a> is not
inside a column, the <a>float reference</a> is the line box of the <a>float
anchor</a>.
The <a>float containing block formatting context</a> is a new block formatting
context with the same dimensions and placement as the <a>float reference</a>.
<dt><dfn>region</dfn>
<dd>
The <a>float reference</a> is the region in a region-chain within which the
<a>float anchor</a> is placed. If the <a>float anchor</a> is not inside a
region, the <a>float reference</a> is the line box of the <a>float
anchor</a>.
The <a>float containing block formatting context</a> is a new block formatting
context with the same dimensions and placement as the <a>float reference</a>.
<dt><dfn>page</dfn>
<dd>
The <a>float reference</a> of the float is the page within which the <a>float
anchor</a> is placed. If the <a>float anchor</a> is not inside a page, the
<a>float reference</a> is the line box of the <a>float anchor</a>.
The <a>float containing block formatting context</a> is a new block formatting
context with the same dimensions and placement as the <a>float reference</a>
</dl>
<div class="issue">
The <a>float containing block formatting context</a> having the same dimensions
as the <a>float reference</a> means that all floats that are not inline floats
cannot move outside of their float references. Is this wanted?
</div>
<div class="issue">
It is not possible to directly specify which element to use as the reference
element. This may be of interest to have.
Maybe something like:
<code><pre>
<style>
.float {
float-reference: float-container;
}
#container {
float-container: true;
}
</style>
<div id="container">
<p>First paragraph<span class="float">FLOAT</span></p>
<p>Second paragraph
<span class="inline-block">[<span class="float">FLOAT</span>] </span>
And some more text</p>
</div>
</pre></code>
This should float both floats with reference to the <div id="container">
element, rather than the <P> and inline <SPAN> elements.
</div>
<h3 id="float-property">The 'float' property</h3>
<pre class="propdef">
Name: float
Value: block-start | block-end | inline-start | inline-end | snap-block | snap-inline | left | right | top | bottom | none
Initial: none
Applies to: all elements.
Inherited: no
Percentages: N/A
Media: visual
Computed value: as specified.
Animatable: no
</pre>
<dl dfn-for="float" dfn-type="value">
<dt><dfn>inline-start</dfn>
<dd>
The element generates a box that is floated to the line-start outer edge of
the <a>float reference</a>. Content flows on the line-end side of the box
(subject to the ‘clear’ property).
<dt><dfn>inline-end</dfn>
<dd>
The element generates a box that is floated to the line-end outer edge of the
<a>float reference</a>. Content flows on the line-start side of the box
(subject to the ‘clear’ property).
<dt><dfn>block-start</dfn>
<dd>
If the <a>float reference</a> is a line box, block-start behaves like
inline-start.
If the <a>float reference</a> is not a line box, the element generates a box
that is floated to the block-start and line-start outer edges of the <a>float
reference</a>.
The initial value of the <a>max-width</a> or <a>max-height</a> property that
refers to the <a>inline size</a> of the float is '100%'.
Content flows on the block-end side of the box (subject to the ‘clear’
property).
<dt><dfn>block-end</dfn>
<dd>
If the <a>float reference</a> is a line box, block-end behaves like inline-end.
If the <a>float reference</a> is not a line box, the element generates a box
that is floated to the block-end and line-start outer edges of the <a>float
reference</a>.
The initial value of the <a>max-width</a> or <a>max-height</a> property that
refers to the <a>inline size</a> of the float is '100%'.
Content flows on the block-start side of the box (subject to the ‘clear’
property).
<div class="issue">
Should block-end and block-start floats be allowed to have an inline-size that
is larger than the that of the float reference? What should happen in that
case?
</div>
<dt><dfn>left</dfn>
<dd>
If the <a>float reference</a> is a line box, behaves like inline-start or
inline-end, whichever corresponds to line-left for the float reference.
Otherwise, behaves like block-end, inline-start or inline-end depending on the float
containing block’s 'direction' and 'writing-mode'.
<dt><dfn>right</dfn>
<dd>
If the <a>float reference</a> is a line box, behaves like inline-start or
inline-end, whichever corresponds to line-right for the float reference.
Otherwise, behaves like block-start, inline-start or inline-end depending on the float
containing block’s 'direction' and 'writing-mode'.
<dt><dfn>top</dfn>
<dd>
Behave like block-start or inline-start depending on the float
containing block’s 'direction' and 'writing-mode'.
<dt><dfn>bottom</dfn>
<dd>
Behave like block-end or inline-end depending on the float
containing block’s 'direction' and 'writing-mode'.
<dt><dfn>snap-block(<length> <length>? [, start | end | near ]?)</dfn>
<dd>
Makes the element float to the start or the end of the block if it
naturally appears within a certain distance from either one. The length
value(s) specifies the maximum distance from the start/end that an element
must be within in order to be floated; one length value specifies the
distance from both the start and the end, two length values specify the
distance from the start and end, respectively.
The optional keyword value specifies where the element is floated: start,
end, or the nearest of the two. The initial value is 'near'. If 'near'
is in effect and the element is within the specified distance both from
the start and the end, end wins.
An element is considered to be a float if it has a snap-block() value,
even if the element does not appear within the specified distance. This
way, it can be determined whether an element is float or not without
laying out the document.
<dt><dfn>snap-block</dfn>
<dd>same as <tt>snap-block(2em, near)</tt>
<dt><dfn>snap-inline(<length> <length>? [, left | right | near ]?)</dfn>
<dd>
Makes the element float to the line start or line end if it naturally
appears within a certain distance from the start or end of the line. The
length value(s) specifies the maximum distance from the start/end that an
element must be within in order to be floated; one length value specifies
the distance from both the start and the end, two length values specify the
distance from the start and end, respectively.
The optional keyword value specifies where the element is floated: line
start, line end, or the nearest of the two. The initial value is 'near'.
If 'near' is in effect and the element is within the specified distance
both from the start and the end, end wins.
An element is considered to be a float if it has a snap-inline() value,
even if the element does not appear within the specified distance. This
way, it can be determined whether an element is float or not without laying
out the document.
<dt><dfn>snap-inline</dfn>
<dd>same as <tt>snap-inline(2em, near)</tt>
<dt><dfn>none</dfn>
<dd>The box is not floated.
</dl>
<div class="issue">
There is currently no way to float into a combination of directions (top right,
right top, left bottom, bottom left, etc.).
</div>
<div class="example">
Float figure to top of reference column:
<pre>
.figure { float-reference: column; float: top }
</pre>
<img alt="sample rendering" src="images/7.png">
</div>
<div class="example">
In this example a block-start float that does not fill the entire <a>inline size</a>
of the float reference is placed at the start of the block and line.
<pre>
.figure { float-reference: column; float: block-start; width: 50% }
</pre>
<img alt="sample rendering" src="images/block_line_start.png">
</div>
<div class="example">
In this example, a figure naturally appears close to a column break. There is
not enough space for the figure in the first column, and it is therefore placed
in the second column, leaving white space at the bottom of the first column.
<img alt="sample rendering" src="images/23.png">
To avoid the white space, the image can be floated to the nearest edge (in the
block direction):
<pre>
.figure { float-reference: column; float: snap-block }
</pre>
In this example, the figure is already at the nearest edge, so it does not
move. However, floats allow subsequent content to be displayed before the
float and the white space can therefore be filled:
<img alt="sample rendering" src="images/7.png">
</div>
<div class="example">
In this example, two figures naturally appear in the text flow:
<img alt="sample rendering" src="images/20.png">
A typographer would typically try to avoid single lines of text above/below
figures, which can be achieved with:
<pre>
div.figure { float-reference: column; float: snap-block(1.5em) }
</pre>
The length value specifies the reach of the snap function; in this example the
second figure is affected, but not the first.
</div>
<div class="example">
In this example, two figures naturally appear in the text flow:
<img alt="sample rendering" src="images/20.png">
To make the figures snap to the nearest edges, this code can be applied:
<pre>
div.figure { float-reference: column; float: snap-block(2.5em) }
</pre>
The resultant rendering is:
<img alt="sample rendering" src="images/22.png">
</div>
<div class="example">
In this example, tables will snap to the top/bottom if the top/bottom of the
border box is closer than '3em' from the top/bottom of the float-reference
which is a block element.
<pre>
table { float: snap }
table { float: snap-block(3em) }
table { float: snap-block(3em, bottom) }
table { float: snap-block(3em 2em, bottom) }
</pre>
</div>
<div class="note">
More examples with regions as <a>float reference</a>s needed.
</div>
<h2 id="clearing_page_floats">
The 'clear' property</h2>
<pre class="propdef">
Name: clear
Value: inline-start | inline-end | block-start | block-end | left | right | top | bottom | none
Initial: none
Applies to: block-level elements, floats, regions, pages
Inherited: no
Percentages: N/A
Media: visual
Computed value: as specified.
Animatable: no
</pre>
To prevent stacking of floats, the 'clear' property can be used:
<dl dfn-for="clear" dfn-type="value">
<dt><dfn>inline-start</dfn>
<dd>
If applied to an inline float, requires that the block-start outer edge of
the box comes after the block-end outer edge of any inline-start-floats
with an inline-start-float-reference that resulted from elements earlier
in the source document.
If applied to a page float, the 'float reference' in which the page float
is placed will be seen as full when determining whether it can host
subsequent page floats that float in the inline-start direction.
<dt><dfn>inline-end</dfn>
<dd>
If applied to a block-level element or a float with a 'float-reference' set
to inline, requires that the block-start outer edge of the box comes after
the block-end outer edge of any inline-end-floats with an
inline-end-float-reference that resulted from elements earlier in the
source document.
If applied to a page float, the 'float reference' in which the page float
is placed will be seen as full when determining whether it can host
subsequent page floats that float in the inline-end direction.
<dt><dfn>block-start</dfn>
<dd>
If applied to a block-level element or a float with a 'float-reference' set
to inline, behave like inline-start.
If applied to a page float, the 'float reference' in which the page float
is placed will be seen as full when determining whether it can host
subsequent page floats that float in the block-start direction.
<dt><dfn>block-end</dfn>
<dd>
If applied to a block-level element or a float with a 'float-reference' set
to inline, behave like inline-end.
If applied to a page float, the 'float reference' in which the page float
is placed will be seen as full when determining whether it can host
subsequent page floats that float in the block-end direction.
<dt><dfn>left</dfn>
<dd>
Behave like block-end, inline-start or inline-end depending on the float
containing block’s 'direction' and 'writing-mode'.
<dt><dfn>right</dfn>
<dd>
Behave like block-start, inline-start or inline-end depending on the float
containing block’s 'direction' and 'writing-mode'.
<dt><dfn>top</dfn>
<dd>
Behave like block-start or inline-start depending on the float
containing block’s 'direction' and 'writing-mode'.
<dt><dfn>bottom</dfn>
<dd>
Behave like block-end or inline-end depending on the float
containing block’s 'direction' and 'writing-mode'.
</dl>
<div class="example">
In this example, the two figures may appear in the same column:
<pre>
.figure { float-reference: column; float: bottom; clear: none }
<div class=figure></div>
<div class=figure></div>
</pre>
<img src="images/16.png">
</div>
<div class="example">
In this example, the two figures will appear in different columns:
<pre>
.figure { float-reference: column; float: bottom; clear: bottom }
<div class=figure></div>
<div class=figure></div>
</pre>
<img src="images/17.png">
</div>
<div class="example">
In this example, the two figures may appear at the bottom of the same column
due to clearing only at the top:
<pre>
.figure { float-reference: column; float: bottom; clear: top }
<div class=figure></div>
<div class=figure></div>
</pre>
<img src="images/16.png">
</div>
<div class="example">
In this example, the two figures will appear in different columns due to
clearing at the bottom:
<pre>
.figure { float-reference: column; float: bottom; clear: bottom }
<div class=figure></div>
<div class=figure></div>
</pre>
<img src="images/17.png">
</div>
<div class="example">
In this example, the two figures end up the top corner of two different
pages:
<pre>
.figure { float-reference: page; float: top; clear: top }
<div class=figure></div>
<div class=figure></div>
</pre>
</div>
<div class="example">
In this example, the two figures request different positions, and they may
therefore end up in the same column:
<pre>
.figure.one { float-reference: column; float: top; clear: top }
.figure.two { float-reference: column; float: bottom; clear: bottom }
<div class="figure one"></div>
<div class="figure two"></div>
</pre>
</div>
<h2 id="deferring_floats">Deferring floats</h2>
A page float can be deferred to another 'fragmentation container' than where
the `float anchor` is placed.
Float deferring assigns an `initial float reference`, yet float stacking can
lead page floats being moved to the subsequent `fragmentation containers` if
their `initial float reference` lacks the space to host them.
This new property is introduced to control deferring floats:
<h3 id="float-defer-property">The 'float-defer' property</h3>
<pre class="propdef">
Name: float-defer
Value: <integer> | last | none
Initial: none
Applies to: floats
Inherited: no
Percentages: N/A
Media: visual
Computed value: as specified.
Animatable: no
</pre>
This property specifies whether the `initial float reference` of a page
float is the 'fragmentation container' in which the `float anchor` is placed
after previous page floats have been placed, or in another one. Values are:
<dl>
<dt>none
<dd>The `initial float reference` is the 'fragmentation container' in which the
`float anchor` is placed after all previous page floats have been placed.
<dt><integer>
<dd>
A positive integer value indicates that the `initial float reference` of
the page float should be Nth 'fragmentation container' of the `fragmentation
flow`, where N is the value of the `float-defer` property plus the order
number of the 'fragmentation container' in which the `float anchor` is placed
after all previous page floats have been placed within the given
'fragmentation flow'. If N is larger than the order number of the last
'fragmentation container' within the given 'fragmentation flow' at the time of
assignment, then N is the order number of the last 'fragmentation container'
within the given 'fragmentation flow'.
A negative integer value indicates that the `initial float reference` of
the page float should be the Nth 'fragmentation container' of the
'fragmentation flow', where N is 1 plus the order number of the last
'fragmentation container' within the given 'fragmentation flow' after all
previous page floats have been placed plus the value of the `float-defer`
property.
Zero is the same as `none`.
<dt>last
<dd>
The `initial float reference` is the last 'fragmentation container' within
the given 'fragmentation flow' after all previous page floats have been
placed.
</dl>
<div class="example">
Float figure to the top of the region that follows the region in which
the float anchor is placed:
<pre>
.figure { float-reference: region }
.figure { float: top }
.figure { float-defer: 1 }
</pre>
</div>
<div class="example">
Float figure to the top of the next-to-last column:
<pre>
.figure { float-reference: column; float: top; float-defer: -2 }
</pre>
<img alt="sample rendering" src="images/7.png">
</div>
<div class="example">
Float figure to the top of the last page:
<pre>
.figure { float-reference: page }
.figure { float: top }
.figure { float-defer: -1 }
</pre>
</div>
<div class="example">
Float figure to the top of the last column:
<pre>
.figure { float-reference: column }
.figure { float: top }
.figure { float-defer: last }
</pre>
</div>
<div class="example">
Float figure to top of the last column:
<pre>
.figure { float-reference: column; float: top; float-defer: last }
</pre>
<img alt="sample rendering" src="images/6.png">
</div>
<h2 id="page-float-placement">Page float placement</h2>
Page floats are placed one by one in the order they appear in the DOM. The
placement of a single page float is a process that has to be terminated
entirely before the placement of a subsequent page float can be initiated. The
placement process consists of the following steps:
<ol>
<li>Determine of the `initial float reference` through consideration of
the `float-defer` value. The 'float reference' is set to be the `initial
float reference`.</li>
<li>Determine if the given 'float reference' has enough space or can be
expanded to host the page float, if the rules of 'float stacking' and 'float
reference growth' are to be followed. If this is not the case, and the
'float reference' is not the last 'fragmentation container' within the given
'fragmentation flow', then make the following 'fragmentation container'
within the given 'fragmentation flow' the 'float reference'.</li>
<li>If the 'float reference' is the last 'fragmentation container' within
the given 'fragmentation flow', and it has not enough space and cannot be
expanded to host the page float, then do the following:</li>
<ol>
<li>If the 'fragmentation context' allows for the addition of another
'fragmentation container' and an additional 'fragmentation container'
would have the needed size to host the page float, a new 'fragmentation
container' is added to the end of the 'fragmentation context'. The 'float
reference' is set the newly created 'fragmentation container'.</li>
<li>Otherwise, if the 'fragmentation container' is a region, then the
'regionOverset` attribute of the 'fragmentation container' is set to
`overset`.
</ol>
<li>The page float is placed in the 'float reference' according to the rules
of 'float stacking' and 'float reference growth'.</li>
</ol>
<h3 id="float-reference-growth">Float reference growth</h3>
Float reference can grow up to the their `max-height` and `max-width` or their
`available size`, whichever is the lowest, in order to accommodate page floats.
<h3 id="float-stacking">Rules for Float stacking</h3>
Page floats are stacked within a given 'float reference' in the order of their
placement and in the direction of the inline- and flow-directions of the
'fragmentation flow' without overlapping with other page floats with the same
'float reference' and by keeping a distance N from padding edge of the 'float
reference' as well as previously placed page floats with the same 'float
reference' and the same 'float' value. For the placement it is assumed that the
page floats in the block directions fill the entire line size of the 'float
reference' and page floats in the inline direction fill the entire block size of
the 'float reference'.
If the page float has a defined 'clear'-value, then the 'float reference' is
closed for all subsequent page floats that floating in the direction specified
by the 'clear'-value.
<p class="issue">
This definition may be a bit too simple, as it does not allow for page floats
that go in the line direction and block direction within the same
'fragmentation container'.
<h2 id="wrapping-around-page-floats">Wrapping around floats</h2>
Floats have their 'wrap-flow' property set to 'both' initially and are treated
like exclusions. This specification does not make any further specification about
wrapping contents around floats.
<div class="issue">
Should the 'wrap-flow' really be set to both, or should the flow be restricted
to only be on one side?
</div>
<h2 id="the-float_offset-property">The 'float-offset' property</h2>
<pre class="propdef">
Name: float-offset
Value: <length> <length> ?
Initial: 0
Applies to: floats
Inherited: no
Percentages: N/A
Media: visual
Computed value: one or two absolute lengths
Animatable: no
</pre>
This property pushes a float in opposite direction of the where it has been
floated with 'float'.
This property can only influence a float along an axis it has been floated.
<div class="example">
<pre>
img {
float-reference: column;
float: left;
float-offset: 2em;
}
</pre>
In this example, the image is floated to the left. Therefore, 'float-offset'
may only push the element to the right.
</div>
<div class="example">
<pre>
img {
float-reference: column;
float: right;
float-offset: 5px;
}
</pre>
<img alt="sample rendering" src="images/14.png">
</div>
Percentage values are computed according to this formula:
<pre>
(containing-block-width - float-width) * percentage
(containing-block-height - float-height) * percentage
</pre>
<div class="example">
Pull quotes are often centered in a column. In this example, the pull quote is
floated to the right, and then pushed back into the center.
<img width=213 src="images/exclusion_wrap_side_left.png">
<pre>
.pullquote {
float-reference: region;
float: right;
float-offset: 50%; /* 50% centers the box */
}
</pre>
<p class="note">
The body text in the example should wrap around both sides of the floated
element to follow this specification.
</div>
<h2 id="relation_to_absolutely_positioned_exclusions">
Floats and absolutely positioned exclusions</h2>
Floats and absolutely positioned exclusions share some common traits, but in the
case of inline floats they are not the same. Floats that are not inline floats
should behave the same as absolutely positioned exclusions with positions and
sizes manually set to prevent overlap between floats and to prevent floats from
moving beyond the edges of the float reference, with the float reference being
grown as much as needed up to its maximum extend to accommodate all containing
floats.
<h3 id="inline_floats_and_absolutely_positioned_exclusions">
Differences between inline floats and absolutely positioned elements</h3>
<em>This section is not normative.</em>
<p>
Inline floats and absolutely positioned elements are both out-of-flow elements.
Absolutely positioned elements that are also exclusions can imitate many of
the features of floats.
<p>
However, in the case of inline floats, the block formatting context that
contains them (the <a>float containing block formatting context</a>) is
required to include the area occupied by the float, which is not a requirement
for absolutely positioned elements.
<div class="example">
An inline float inside a <a>float containing block formatting context</a> given
by a display-inline-block element. The element, which has a green border, is
expanded to include the brown float.
<code><pre>
<style>
.float {
float: left;
margin: 5px;
}
.border {
border: 3px solid black;
margin: 5px;
}
#outer {
border: 1px solid green;
display: inline-block;
}
canvas {
background-color: brown;
}
p {
margin: 5px;
}
</style>
<div id="outer">
<p class="border">
<span class="float border">
<canvas width="100" height="100"/>
</span>
First paragraph.
</p>
<p class="border">
Second paragraph and some more text.
</p>
</div>
</pre></code>
<img alt="sample rendering" src="images/float_containing_context.png">
In comparison, the below is the same HTML, but the float is replaced by an
absolutely positioned element that is also an exclusion. The <a>float
containing block formatting context</a> is still given by a
display-inline-block element. However, the element, marked by a green border,
does not expand to include the brown, absolutely positioned element.
<code><pre>
<style>
.float {
position: absolute;
top: 8px;
left: 8px;
wrap-flow: both;
}
.border {
border: 3px solid black;
margin: 5px;
}
#outer {
border: 1px solid green;
display: inline-block;
position: relative;
}
canvas {
background-color: brown;
}
</style>
<div id="outer">
<p class="border">
<span class="float border">
<canvas width="100" height="100"/>
</span>
First paragraph.
</p>
<p class="border">
Second paragraph and some more text.
</p>
</div>
</pre></code>
<img alt="sample rendering" src="images/positioned_containing_context.png">
</div>
<h2 id="overconstrained-page-floats">Overconstrained floats</h2>
In many cases, the specified values on these properties cannot be honored.
<div class="example">
The number of columns is limited, and high values therefore cannot be honored:
<pre>
.figure { float-reference: column; float: top; float-defer: 1000 }
</pre>
</div>
<div class="example">
A narrow screen may only have room for one column, in which case this request
cannot be honored:
<pre>