Skip to content

Commit 3c69ce5

Browse files
committed
Tweak the rules about abspos positioning again.
1 parent 781229f commit 3c69ce5

2 files changed

Lines changed: 161 additions & 63 deletions

File tree

css3-flexbox/Overview.html

Lines changed: 95 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -206,11 +206,11 @@
206206

207207
<h1 id=head-box-flexible>CSS Flexible Box Layout Module</h1>
208208

209-
<h2 class="no-num no-toc" id=w3c-working>Editor's Draft, 25 July 2012</h2>
209+
<h2 class="no-num no-toc" id=w3c-working>Editor's Draft, 31 July 2012</h2>
210210

211211
<dl>
212212
<dt>This version:
213-
<!--<dd><a href="http://www.w3.org/TR/2012/ED-css3-flexbox-20120725/">http://www.w3.org/TR/2012/WD-css3-flexbox-20120725/</a>-->
213+
<!--<dd><a href="http://www.w3.org/TR/2012/ED-css3-flexbox-20120731/">http://www.w3.org/TR/2012/WD-css3-flexbox-20120731/</a>-->
214214

215215

216216
<dd><a
@@ -382,16 +382,19 @@ <h2 class="no-num no-toc" id=table>Table of contents</h2>
382382

383383
<li><a href="#flex-items"><span class=secno>4. </span> Flex Items</a>
384384
<ul class=toc>
385-
<li><a href="#item-margins"><span class=secno>4.1. </span> Flex Item
385+
<li><a href="#abspos-items"><span class=secno>4.1. </span>
386+
Absolutely-Positioned Flex Items</a>
387+
388+
<li><a href="#item-margins"><span class=secno>4.2. </span> Flex Item
386389
Margins</a>
387390

388-
<li><a href="#painting"><span class=secno>4.2. </span> Flex Item
391+
<li><a href="#painting"><span class=secno>4.3. </span> Flex Item
389392
Painting</a>
390393

391-
<li><a href="#visibility-collapse"><span class=secno>4.3. </span>
394+
<li><a href="#visibility-collapse"><span class=secno>4.4. </span>
392395
Collapsed Items</a>
393396

394-
<li><a href="#min-size-auto"><span class=secno>4.4. </span> Implied
397+
<li><a href="#min-size-auto"><span class=secno>4.5. </span> Implied
395398
Minimum Size of Flex Items</a>
396399
</ul>
397400

@@ -981,37 +984,91 @@ <h2 id=flex-items><span class=secno>4. </span> Flex Items</h2>
981984
class=property>flex</code></a>’ longhands apply to the table box as
982985
follows: The contents of any caption boxes contribute to the calculation
983986
of the table wrapper box's min-content and max-content sizes. However, the
984-
<a href="#flex-item"><i>flex item</i></a><code class=css>s final size
985-
is calculated by first laying out the captions, and then performing layout
986-
as if the distance between the table wrapper box</code>’s edges and the
987-
table box's content edges were all part of the table box's border+padding
988-
area, and the table box were the <a href="#flex-item"><i>flex
989-
item</i></a>.
990-
991-
<p id=abspos-items> The <a
992-
href="http://www.w3.org/TR/CSS21/visudet.html#abs-non-replaced-width">hypothetical
993-
box</a> used to calculate the <i>static position</i> <a href="#CSS21"
994-
rel=biblioentry>[CSS21]<!--{{!CSS21}}--></a> of an absolutely-positioned
995-
<a href="#flex-item"><i>flex item</i></a> corresponds to that of an
996-
anonymous empty flex item whose <i>main-axis</i> position, after <a
997-
href="#order-property">reordering</a> coincides with the <a
998-
href="#main-start"><i>main-start</i></a> edge of any subsequent real flex
999-
item on the flex line, and, being hypothetical, has no effect on flex
1000-
layout. If there is no subsequent real flex item, the hypothetical box's
1001-
<i>main-axis</i> position is that of a hypothetical last item on the flex
1002-
line, after any packing spaces that were introduced around any previous
1003-
real items due to ‘<code class=css>content-justify:
1004-
space-around</code>’.
1005-
1006-
<h3 id=item-margins><span class=secno>4.1. </span> Flex Item Margins</h3>
987+
<a href="#flex-item"><i>flex item</i></a>&apos;s final size is calculated
988+
by first laying out the captions, and then performing layout as if the
989+
distance between the table wrapper box's edges and the table box's content
990+
edges were all part of the table box's border+padding area, and the table
991+
box were the <a href="#flex-item"><i>flex item</i></a>.
992+
993+
<h3 id=abspos-items><span class=secno>4.1. </span> Absolutely-Positioned
994+
Flex Items</h3>
995+
996+
<p> An absolutely-positioned <a href="#flex-item"><i>flex item</i></a> does
997+
not participate in flex layout beyond the <a
998+
href="#algo-flex-order">reordering step</a>. However, if both ‘<code
999+
class=property>left</code>’ and ‘<code class=property>right</code>
1000+
or both ‘<code class=property>top</code>’ and ‘<code
1001+
class=property>bottom</code>’ are ‘<a href="#align-self-auto"><code
1002+
class=css>auto</code></a>’, then the used value of those properties are
1003+
computed from its <dfn id=flex-item-static-position>static position</dfn>,
1004+
as follows:
1005+
1006+
<p> In the <a href="#main-axis"><i>main axis</i></a>,
1007+
1008+
<ol>
1009+
<li> If there is a subsequent in-flow <a href="#flex-item"><i>flex
1010+
item</i></a> on the same <i>flex line</i>, the <a
1011+
href="#flex-item-static-position"><i>static position</i></a> is the outer
1012+
<a href="#main-start"><i>main-start</i></a> edge of that <a
1013+
href="#flex-item"><i>flex item</i></a>.
1014+
1015+
<li> Otherwise, if there is a preceding in-flow <a
1016+
href="#flex-item"><i>flex item</i></a> on the same <i>flex line</i>, the
1017+
<a href="#flex-item-static-position"><i>static position</i></a> is the
1018+
outer <a href="#main-end"><i>main-end</i></a> edge of that <a
1019+
href="#flex-item"><i>flex item</i></a>.
1020+
1021+
<li> Otherwise, the <a href="#flex-item-static-position"><i>static
1022+
position</i></a> is based on the value of ‘<a
1023+
href="#justify-content"><code
1024+
class=property>justify-content</code></a>’ on the <a
1025+
href="#flex-container"><i>flex container</i></a>:
1026+
<ul>
1027+
<li> if ‘<a href="#justify-content"><code
1028+
class=property>justify-content</code></a>’ is ‘<a
1029+
href="#align-content-flex-start"><code
1030+
class=css>flex-start</code></a>’ or ‘<a
1031+
href="#align-content-space-between"><code
1032+
class=css>space-between</code></a>’, it is the inner <a
1033+
href="#main-start"><i>main-start</i></a> edge of the <a
1034+
href="#flex-container"><i>flex container</i></a>;
1035+
1036+
<li> if ‘<a href="#justify-content"><code
1037+
class=property>justify-content</code></a>’ is ‘<a
1038+
href="#align-content-center"><code class=css>center</code></a>’ or
1039+
<a href="#align-content-space-around"><code
1040+
class=css>space-around</code></a>’, it is the center of the content
1041+
area of the <a href="#flex-container"><i>flex container</i></a>;
1042+
1043+
<li> if ‘<a href="#justify-content"><code
1044+
class=property>justify-content</code></a>’ is ‘<code
1045+
class=css>end</code>’, it is the inner <a
1046+
href="#main-end"><i>main-end</i></a> edge of the <a
1047+
href="#flex-container"><i>flex container</i></a>.
1048+
</ul>
1049+
</ol>
1050+
1051+
<p> In the <a href="#cross-axis"><i>cross axis</i></a>, if there is a
1052+
preceding in-flow <a href="#flex-item"><i>flex item</i></a>, the <a
1053+
href="#flex-item-static-position"><i>static position</i></a> is the <a
1054+
href="#cross-start"><i>cross-start</i></a> edge of the <i>flex-line</i>
1055+
that item is in. Otherwise, the <a
1056+
href="#flex-item-static-position"><i>static position</i></a> is the
1057+
<i>cross-start edge</i> of the first <i>flex line</i>.
1058+
1059+
<p class=note> These rules are intended to more-or-less match what the
1060+
position would be if the abspos was a 0x0 flex item that participated in
1061+
layout.
1062+
1063+
<h3 id=item-margins><span class=secno>4.2. </span> Flex Item Margins</h3>
10071064

10081065
<p> The margins of adjacent <a href="#flex-item"><i>flex items</i></a> do
10091066
not collapse. Auto margins absorb extra space in the corresponding
10101067
dimension and can be used for alignment and to push adjacent flex items
10111068
apart; see <a href="#auto-margins">Aligning with ‘<code
10121069
class=css>auto</code>’ margins</a>.
10131070

1014-
<h3 id=painting><span class=secno>4.2. </span> Flex Item Painting</h3>
1071+
<h3 id=painting><span class=secno>4.3. </span> Flex Item Painting</h3>
10151072

10161073
<p> <a href="#flex-item"><i>Flex items</i></a> paint exactly the same as
10171074
block-level elements in the normal flow, except that ‘<code
@@ -1023,7 +1080,7 @@ <h3 id=painting><span class=secno>4.2. </span> Flex Item Painting</h3>
10231080
<p class=note> Note: Descendants that are positioned outside a flex item
10241081
still participate in any stacking context established by the flex item.
10251082

1026-
<h3 id=visibility-collapse><span class=secno>4.3. </span> Collapsed Items</h3>
1083+
<h3 id=visibility-collapse><span class=secno>4.4. </span> Collapsed Items</h3>
10271084

10281085
<p> Specifying ‘<code class=css>visibility:collapse</code>’ on a flex
10291086
item causes it to become a <dfn id=collapsed-flex-item
@@ -1156,7 +1213,7 @@ <h3 id=visibility-collapse><span class=secno>4.3. </span> Collapsed Items</h3>
11561213
class=css>visibility: collapse</code>’ is still recommended for dynamic
11571214
cases.)
11581215

1159-
<h3 id=min-size-auto><span class=secno>4.4. </span> Implied Minimum Size of
1216+
<h3 id=min-size-auto><span class=secno>4.5. </span> Implied Minimum Size of
11601217
Flex Items</h3>
11611218

11621219
<p> To provide a more reasonable default minimum size for flex items, this
@@ -4128,10 +4185,10 @@ <h2 class=no-num id=index>Index</h2>
41284185
title="''center''"><strong>8.2.</strong></a>
41294186

41304187
<li>collapsed, <a href="#collapsed-flex-item"
4131-
title=collapsed><strong>4.3.</strong></a>
4188+
title=collapsed><strong>4.4.</strong></a>
41324189

41334190
<li>collapsed flex item, <a href="#collapsed-flex-item"
4134-
title="collapsed flex item"><strong>4.3.</strong></a>
4191+
title="collapsed flex item"><strong>4.4.</strong></a>
41354192

41364193
<li><a href="#flex-flow-column"><code class=css>column</code></a>’,
41374194
<a href="#flex-flow-column" title="''column''"><strong>5.1.</strong></a>
@@ -4281,7 +4338,7 @@ <h2 class=no-num id=index>Index</h2>
42814338
title=main-start><strong>2.</strong></a>
42824339

42834340
<li>min-width/height:auto, <a href="#min-auto"
4284-
title="min-width/height:auto"><strong>4.4.</strong></a>
4341+
title="min-width/height:auto"><strong>4.5.</strong></a>
42854342

42864343
<li>multi-line, <a href="#multi-line"
42874344
title=multi-line><strong>6.</strong></a>
@@ -4324,6 +4381,9 @@ <h2 class=no-num id=index>Index</h2>
43244381
href="#justify-content-space-between"
43254382
title="''space-between''"><strong>8.2.</strong></a>
43264383

4384+
<li>static position, <a href="#flex-item-static-position"
4385+
title="static position"><strong>4.1.</strong></a>
4386+
43274387
<li><a href="#align-content-stretch"><code
43284388
class=css>stretch</code></a>’, <a href="#align-content-stretch"
43294389
title="''stretch''"><strong>8.4.</strong></a>, <a

css3-flexbox/Overview.src.html

Lines changed: 66 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -652,27 +652,63 @@ <h2 id='flex-items'>
652652
However, like 'width' and 'height', the 'flex' longhands apply to the table box as follows:
653653
The contents of any caption boxes contribute to the calculation of
654654
the table wrapper box's min-content and max-content sizes.
655-
However, the <i>flex item</i>'s final size is calculated by
655+
However, the <i>flex item</i>&apos;s final size is calculated by
656656
first laying out the captions,
657657
and then performing layout as if the distance between
658658
the table wrapper box's edges and the table box's content edges
659659
were all part of the table box's border+padding area,
660660
and the table box were the <i>flex item</i>.
661661

662-
<p id='abspos-items'>
663-
The <a href="http://www.w3.org/TR/CSS21/visudet.html#abs-non-replaced-width">hypothetical box</a> used to calculate the <i>static position</i> [[!CSS21]]
664-
of an absolutely-positioned <i>flex item</i> corresponds to
665-
that of an anonymous empty flex item
666-
whose <i>main-axis</i> position,
667-
after <a href="#order-property">reordering</a>
668-
coincides with the <i>main-start</i> edge of
669-
any subsequent real flex item on the flex line,
670-
and, being hypothetical, has no effect on flex layout.
671-
If there is no subsequent real flex item,
672-
the hypothetical box's <i>main-axis</i> position is
673-
that of a hypothetical last item on the flex line,
674-
after any packing spaces that were introduced
675-
around any previous real items due to ''content-justify: space-around''.
662+
<h3 id='abspos-items'>
663+
Absolutely-Positioned Flex Items</h3>
664+
665+
<p>
666+
An absolutely-positioned <i>flex item</i> does not participate in flex layout
667+
beyond the <a href="#algo-flex-order">reordering step</a>.
668+
However, if both 'left' and 'right' or both 'top' and 'bottom' are ''auto'',
669+
then the used value of those properties
670+
are computed from its <dfn id='flex-item-static-position'>static position</dfn>, as follows:
671+
672+
<p>
673+
In the <i>main axis</i>,
674+
675+
<ol>
676+
<li>
677+
If there is a subsequent in-flow <i>flex item</i> on the same <i>flex line</i>,
678+
the <i>static position</i> is the outer <i>main-start</i> edge of that <i>flex item</i>.
679+
680+
<li>
681+
Otherwise, if there is a preceding in-flow <i>flex item</i> on the same <i>flex line</i>,
682+
the <i>static position</i> is the outer <i>main-end</i> edge of that <i>flex item</i>.
683+
684+
<li>
685+
Otherwise, the <i>static position</i> is based on the value of 'justify-content' on the <i>flex container</i>:
686+
687+
<ul>
688+
<li>
689+
if 'justify-content' is ''flex-start'' or ''space-between'',
690+
it is the inner <i>main-start</i> edge of the <i>flex container</i>;
691+
692+
<li>
693+
if 'justify-content' is ''center'' or ''space-around'',
694+
it is the center of the content area of the <i>flex container</i>;
695+
<li>
696+
if 'justify-content' is ''end'',
697+
it is the inner <i>main-end</i> edge of the <i>flex container</i>.
698+
</ul>
699+
</ol>
700+
701+
<p>
702+
In the <i>cross axis</i>,
703+
if there is a preceding in-flow <i>flex item</i>,
704+
the <i>static position</i> is the <i>cross-start</i> edge of the <i>flex-line</i>
705+
that item is in.
706+
Otherwise, the <i>static position</i> is the <i>cross-start edge</i> of the first <i>flex line</i>.
707+
708+
<p class='note'>
709+
These rules are intended to more-or-less match
710+
what the position would be if the abspos was a 0x0 flex item
711+
that participated in layout.
676712

677713
<h3 id='item-margins'>
678714
Flex Item Margins</h3>
@@ -864,21 +900,23 @@ <h3 id='min-size-auto'>
864900

865901
<div class="note" id="min-size-opt">
866902
<p>
867-
Note that while a content-based minimum size is often appropriate,
868-
and helps prevent content from overlapping or spilling outside its container,
869-
in some cases it is not:
903+
Note that while a content-based minimum size is often appropriate,
904+
and helps prevent content from overlapping or spilling outside its container,
905+
in some cases it is not:
906+
870907
<p>
871-
In particular, if flex sizing is being used for a major content area of a document,
872-
it is better to set an explicit font-relative minimum width such as ''min-width: 12em''.
873-
A content-based minimum width could result in a large table or large image
874-
stretching the size of the entire content area into an overflow zone,
875-
and thereby making lines of text gratuitously long and hard to read.
908+
In particular, if flex sizing is being used for a major content area of a document,
909+
it is better to set an explicit font-relative minimum width such as ''min-width: 12em''.
910+
A content-based minimum width could result in a large table or large image
911+
stretching the size of the entire content area into an overflow zone,
912+
and thereby making lines of text gratuitously long and hard to read.
913+
876914
<p>
877-
Note also, when content-based sizing is used on an item with large amounts of content,
878-
the layout engine must traverse all of this content before finding its minimum size,
879-
whereas if the author sets an explicit minimum, this is not necessary.
880-
(For items with small amounts of content, however,
881-
this traversal is trivial and therefore not a problem.)
915+
Note also, when content-based sizing is used on an item with large amounts of content,
916+
the layout engine must traverse all of this content before finding its minimum size,
917+
whereas if the author sets an explicit minimum, this is not necessary.
918+
(For items with small amounts of content, however,
919+
this traversal is trivial and therefore not a problem.)
882920
</div>
883921

884922
<h2>

0 commit comments

Comments
 (0)