Skip to content

Commit 5eea74b

Browse files
committed
Merge pull request #24 from johanneswilm/master
[css-page-floats] Add explanations on interactions between page floats and variable height float references
2 parents 3c94763 + 76d3336 commit 5eea74b

File tree

1 file changed

+138
-99
lines changed

1 file changed

+138
-99
lines changed

css-page-floats/Overview.bs

+138-99
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ Ignored Terms: near, 3em, intrude, top-corner, bottom-corner, left, right, both,
2121

2222
<h2 id="overview">Overview</h2>
2323

24+
<em>This section is not normative.</em>
25+
2426
This specification adds new keywords on the 'float' property.
2527

2628
This document allows to specify whether a <a>float</a> floats to align with a
@@ -65,110 +67,15 @@ Terminology</h2>
6567
<dt><dfn>Float containing block formatting context</dfn>
6668
<dd>
6769
The block formatting context inside of which the float is embedded.
70+
<dt><dfn>Initial float reference</dfn>
71+
<dd>
72+
The entity to which the float is aligned initially, before automatic float
73+
deference takes place.
6874
<dt><dfn>Float reference</dfn>
6975
<dd>
7076
The entity to which the float is aligned.
7177
</dl>
7278

73-
<h2 id="positioning">
74-
Difference between inline floats and absolutely positioned elements</h2>
75-
76-
<p>
77-
Inline floats and absolutely positioned elements are both out-of-flow elements.
78-
Absolutely positioned elements that are also exclusions can imitate many of
79-
the features of floats.
80-
81-
<p>
82-
However, in the case of inline floats, the block formatting context that
83-
contains them (the <a>float containing block formatting context</a>) is
84-
required to include the area occupied by the float, which is not a requirement
85-
for absolutely positioned elements.
86-
87-
<div class="example">
88-
An inline float inside a <a>float containing block formatting context</a> given
89-
by a display-inline-block element. The element, which has a green border, is
90-
expanded to include the brown float.
91-
92-
<code><pre>
93-
&lt;style>
94-
.float {
95-
float: left;
96-
margin: 5px;
97-
}
98-
.border {
99-
border: 3px solid black;
100-
margin: 5px;
101-
}
102-
#outer {
103-
border: 1px solid green;
104-
display: inline-block;
105-
}
106-
canvas {
107-
background-color: brown;
108-
}
109-
p {
110-
margin: 5px;
111-
}
112-
&lt;/style>
113-
&lt;div id="outer">
114-
&lt;p class="border">
115-
&lt;span class="float border">
116-
&lt;canvas width="100" height="100"/>
117-
&lt;/span>
118-
First paragraph.
119-
&lt;/p>
120-
&lt;p class="border">
121-
Second paragraph and some more text.
122-
&lt;/p>
123-
&lt;/div>
124-
</pre></code>
125-
126-
<img alt="sample rendering" src="images/float_containing_context.png">
127-
128-
In comparison, the below is the same HTML, but the float is replaced by an
129-
absolutely positioned element that is also an exclusion. The <a>float
130-
containing block formatting context</a> is still given by a
131-
display-inline-block element. However, the element, marked by a green border,
132-
does not expand to include the brown, absolutely positioned element.
133-
134-
<code><pre>
135-
&lt;style>
136-
.float {
137-
position: absolute;
138-
top: 8px;
139-
left: 8px;
140-
wrap-flow: both;
141-
}
142-
.border {
143-
border: 3px solid black;
144-
margin: 5px;
145-
}
146-
#outer {
147-
border: 1px solid green;
148-
display: inline-block;
149-
position: relative;
150-
}
151-
canvas {
152-
background-color: brown;
153-
}
154-
&lt;/style>
155-
&lt;div id="outer">
156-
&lt;p class="border">
157-
&lt;span class="float border">
158-
&lt;canvas width="100" height="100"/>
159-
&lt;/span>
160-
First paragraph.
161-
&lt;/p>
162-
&lt;p class="border">
163-
Second paragraph and some more text.
164-
&lt;/p>
165-
&lt;/div>
166-
</pre></code>
167-
168-
<img alt="sample rendering" src="images/positioned_containing_context.png">
169-
170-
</div>
171-
17279

17380
<h2 id="floating">
17481
Floating to the inline-start/inline-end and block-start/block-end</h2>
@@ -921,7 +828,139 @@ img {
921828

922829
</div>
923830

831+
<h2 id="relation_to_absolutely_positioned_exclusions">
832+
Floats and absolutely positioned exclusions</h2>
833+
834+
Floats and absolutely positioned exclusions share some common traits, but in the
835+
case of inline floats they are not the same. Floats that are not inline floats
836+
should behave the same as absolutely positioned exclusions with positions and
837+
sizes manually set to prevent overlap between floats and to prevent floats from
838+
moving beyond the edges of the float reference, with the float reference being
839+
grown as much as needed up to its maximum extend to accommodate all containing
840+
floats.
841+
842+
<h3 id="inline_floats_and_absolutely_positioned_exclusions">
843+
Differences between inline floats and absolutely positioned elements</h3>
844+
845+
<em>This section is not normative.</em>
846+
847+
<p>
848+
Inline floats and absolutely positioned elements are both out-of-flow elements.
849+
Absolutely positioned elements that are also exclusions can imitate many of
850+
the features of floats.
851+
852+
<p>
853+
However, in the case of inline floats, the block formatting context that
854+
contains them (the <a>float containing block formatting context</a>) is
855+
required to include the area occupied by the float, which is not a requirement
856+
for absolutely positioned elements.
857+
858+
<div class="example">
859+
An inline float inside a <a>float containing block formatting context</a> given
860+
by a display-inline-block element. The element, which has a green border, is
861+
expanded to include the brown float.
862+
863+
<code><pre>
864+
&lt;style>
865+
.float {
866+
float: left;
867+
margin: 5px;
868+
}
869+
.border {
870+
border: 3px solid black;
871+
margin: 5px;
872+
}
873+
#outer {
874+
border: 1px solid green;
875+
display: inline-block;
876+
}
877+
canvas {
878+
background-color: brown;
879+
}
880+
p {
881+
margin: 5px;
882+
}
883+
&lt;/style>
884+
&lt;div id="outer">
885+
&lt;p class="border">
886+
&lt;span class="float border">
887+
&lt;canvas width="100" height="100"/>
888+
&lt;/span>
889+
First paragraph.
890+
&lt;/p>
891+
&lt;p class="border">
892+
Second paragraph and some more text.
893+
&lt;/p>
894+
&lt;/div>
895+
</pre></code>
896+
897+
<img alt="sample rendering" src="images/float_containing_context.png">
898+
899+
In comparison, the below is the same HTML, but the float is replaced by an
900+
absolutely positioned element that is also an exclusion. The <a>float
901+
containing block formatting context</a> is still given by a
902+
display-inline-block element. However, the element, marked by a green border,
903+
does not expand to include the brown, absolutely positioned element.
904+
905+
<code><pre>
906+
&lt;style>
907+
.float {
908+
position: absolute;
909+
top: 8px;
910+
left: 8px;
911+
wrap-flow: both;
912+
}
913+
.border {
914+
border: 3px solid black;
915+
margin: 5px;
916+
}
917+
#outer {
918+
border: 1px solid green;
919+
display: inline-block;
920+
position: relative;
921+
}
922+
canvas {
923+
background-color: brown;
924+
}
925+
&lt;/style>
926+
&lt;div id="outer">
927+
&lt;p class="border">
928+
&lt;span class="float border">
929+
&lt;canvas width="100" height="100"/>
930+
&lt;/span>
931+
First paragraph.
932+
&lt;/p>
933+
&lt;p class="border">
934+
Second paragraph and some more text.
935+
&lt;/p>
936+
&lt;/div>
937+
</pre></code>
938+
939+
<img alt="sample rendering" src="images/positioned_containing_context.png">
940+
941+
</div>
924942

943+
<h3 id="fixed_height_float_references">
944+
Page floats with float references with fixed heights
945+
</h3>
946+
947+
If a page floats are inside a float reference with a fixed height, the float
948+
reference is filled up until it cannot contain the following page float. All
949+
subsequent page floats are deferred to the next column/region/page.
950+
951+
<h3 id="variable_height_nomaximum_float_references">
952+
Page floats with variable height float references with no maximum height
953+
</h3>
954+
Variable height float references are grown to accommodate all its containing page
955+
floats. Page floats inside of variable height float references without a maximum
956+
height are therefore never deferred automatically.
957+
958+
<h3 id="variable_heihgt_maximum_height_float_references">
959+
Page floats with variable height float references with a set maximum height
960+
</h3>
961+
Float references with a variable height with a set max height are grown to
962+
accommodate all of its containing page floats up to their maximum height. Subsequent
963+
page floats are deferred to the following column/region/page.
925964

926965

927966
<h2 id="overconstrained-page-floats">Overconstrained floats</h2>

0 commit comments

Comments
 (0)