Skip to content

Commit 4da7281

Browse files
committed
[css-flexbox] Rephrase abspos child positioning in Rossen's preferred terms. (Should be no behavior change.)
--HG-- extra : rebase_source : 4ae3919de2c74cea1d8b8321e2ab1c2ef62def1c
1 parent 4977943 commit 4da7281

2 files changed

Lines changed: 61 additions & 23 deletions

File tree

css-flexbox/Overview.bs

Lines changed: 27 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -617,16 +617,35 @@ Absolutely-Positioned Flex Children</h3>
617617
An absolutely-positioned child of a <i>flex container</i> does not participate in flex layout
618618
beyond the <a href="#algo-flex-order">reordering step</a>.
619619

620-
Its static position is calculated by first doing full flex layout without the absolutely-positioned children,
621-
then positioning each absolutely-positioned child as if it were the sole <a>flex item</a>
622-
in the <a>flex container</a>,
623-
assuming both the child and the <a>flex container</a> were fixed size boxes of their used size.
620+
The static position of an absolutely-positioned child of a <a>flex container</a>
621+
is determined by the 'justify-*'/'align-*' properties set on the <a>flex container</a> and the child:
622+
623+
<dl>
624+
<dt>In the <a>main axis</a>
625+
<dd>
626+
If the <a>flex container's</a> 'justify-content' value
627+
would distribute a single <a>flex item</a>
628+
to the start, center, or end side of the <a>main axis</a>,
629+
the static position in the <a>main axis</a> is the start, center, or end respectively.
630+
631+
<dt>In the <a>cross axis</a>
632+
<dd>
633+
If the child's 'align-self' value,
634+
if specified on a hypothetical single <a>flex item</a> child of the <a>flex container</a>,
635+
would align that hypothetical child to the start, center, or end side of the <a>cross axis</a>,
636+
the static position in the <a>cross axis</a> is the start, center, or end respectively.
637+
</dl>
638+
639+
Further, the absolutely-positioned child aligns its start, center, or end in the given axis
640+
(whichever position the static position was set to)
641+
to the static position.
624642

625643
<div class='example'>
626-
For example, by default, the static position of an absolutely positioned child aligns it to the main-start/cross-start corner,
627-
corresponding to the default values of 'justify-content' and 'align-content' on the <a>flex container</a>.
628-
Setting ''justify-content:center'' on the <a>flex container</a>, however,
629-
would center it in the main axis.
644+
The effect of this is that if you set, for example,
645+
''align-content: center;'' on an absolutely-positioned child of a <a>flex container</a>,
646+
the child will be centered in the <a>flex container's</a> <a>cross axis</a>.
647+
(The static position will be in the center of the <a>cross axis</a>,
648+
and the child will align its center with the static position.)
630649
</div>
631650

632651
<h3 id='item-margins'>

css-flexbox/Overview.html

Lines changed: 34 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@
246246
</p>
247247
<h1 class="p-name no-ref" id=title>CSS Flexible Box Layout Module Level 1</h1>
248248
<h2 class="no-num no-toc no-ref heading settled heading" id=subtitle><span class=content>Editor’s Draft,
249-
<span class=dt-updated><span class=value-title title=20140507>7 May 2014</span></span></span></h2>
249+
<span class=dt-updated><span class=value-title title=20140519>19 May 2014</span></span></span></h2>
250250
<div data-fill-with=spec-metadata><dl><dt>This version:<dd><a class=u-url href=http://dev.w3.org/csswg/css-flexbox/>http://dev.w3.org/csswg/css-flexbox/</a><dt>Latest version:<dd><a href=http://www.w3.org/TR/css-flexbox-1/>http://www.w3.org/TR/css-flexbox-1/</a><dt>Editor’s Draft:<dd><a href=http://dev.w3.org/csswg/css-flexbox/>http://dev.w3.org/csswg/css-flexbox/</a><dt>Previous Versions:<dd><a href=http://www.w3.org/TR/2012/CR-css3-flexbox-20120918/ rel=previous>http://www.w3.org/TR/2012/CR-css3-flexbox-20120918/</a><dd><a href=http://www.w3.org/TR/2012/WD-css3-flexbox-20120612/ rel=previous>http://www.w3.org/TR/2012/WD-css3-flexbox-20120612/</a><dd><a href=http://www.w3.org/TR/2012/WD-css3-flexbox-20120322/ rel=previous>http://www.w3.org/TR/2012/WD-css3-flexbox-20120322/</a><dd><a href=http://www.w3.org/TR/2011/WD-css3-flexbox-20111129/ rel=previous>http://www.w3.org/TR/2011/WD-css3-flexbox-20111129/</a><dd><a href=http://www.w3.org/TR/2011/WD-css3-flexbox-20110322/ rel=previous>http://www.w3.org/TR/2011/WD-css3-flexbox-20110322/</a><dd><a href=http://www.w3.org/TR/2009/WD-css3-flexbox-20090723/ rel=previous>http://www.w3.org/TR/2009/WD-css3-flexbox-20090723/</a>
251251
<dt>Feedback:</dt>
252252
<dd><a href="mailto:www-style@w3.org?subject=%5Bcss-flexbox%5D%20feedback">www-style@w3.org</a>
@@ -770,16 +770,35 @@ <h3 class="heading settled heading" data-level=4.1 id=abspos-items><span class=s
770770
<p>An absolutely-positioned child of a <a data-link-type=dfn href=#flex-container title="flex container">flex container</a> does not participate in flex layout
771771
beyond the <a href=#algo-flex-order>reordering step</a>.</p>
772772

773-
<p>Its static position is calculated by first doing full flex layout without the absolutely-positioned children,
774-
then positioning each absolutely-positioned child as if it were the sole <a data-link-type=dfn href=#flex-item title="flex item">flex item</a>
775-
in the <a data-link-type=dfn href=#flex-container title="flex container">flex container</a>,
776-
assuming both the child and the <a data-link-type=dfn href=#flex-container title="flex container">flex container</a> were fixed size boxes of their used size.</p>
773+
<p>The static position of an absolutely-positioned child of a <a data-link-type=dfn href=#flex-container title="flex container">flex container</a>
774+
is determined by the <a class=property data-link-type=propdesc title=justify-*>justify-*</a>/<a class=property data-link-type=propdesc title=align-*>align-*</a> properties set on the <a data-link-type=dfn href=#flex-container title="flex container">flex container</a> and the child:</p>
775+
776+
<dl>
777+
<dt>In the <a data-link-type=dfn href=#main-axis title="main axis">main axis</a>
778+
<dd>
779+
If the <a data-link-type=dfn href=#flex-container title="flex container’s">flex container’s</a> <a class=property data-link-type=propdesc href=#propdef-justify-content title=justify-content>justify-content</a> value
780+
would distribute a single <a data-link-type=dfn href=#flex-item title="flex item">flex item</a>
781+
to the start, center, or end side of the <a data-link-type=dfn href=#main-axis title="main axis">main axis</a>,
782+
the static position in the <a data-link-type=dfn href=#main-axis title="main axis">main axis</a> is the start, center, or end respectively.
783+
784+
<dt>In the <a data-link-type=dfn href=#cross-axis title="cross axis">cross axis</a>
785+
<dd>
786+
If the child’s <a class=property data-link-type=propdesc href=#propdef-align-self title=align-self>align-self</a> value,
787+
if specified on a hypothetical single <a data-link-type=dfn href=#flex-item title="flex item">flex item</a> child of the <a data-link-type=dfn href=#flex-container title="flex container">flex container</a>,
788+
would align that hypothetical child to the start, center, or end side of the <a data-link-type=dfn href=#cross-axis title="cross axis">cross axis</a>,
789+
the static position in the <a data-link-type=dfn href=#cross-axis title="cross axis">cross axis</a> is the start, center, or end respectively.
790+
</dl>
791+
792+
<p>Further, the absolutely-positioned child aligns its start, center, or end in the given axis
793+
(whichever position the static position was set to)
794+
to the static position.</p>
777795

778796
<div class=example>
779-
For example, by default, the static position of an absolutely positioned child aligns it to the main-start/cross-start corner,
780-
corresponding to the default values of <a class=property data-link-type=propdesc href=#propdef-justify-content title=justify-content>justify-content</a> and <a class=property data-link-type=propdesc href=#propdef-align-content title=align-content>align-content</a> on the <a data-link-type=dfn href=#flex-container title="flex container">flex container</a>.
781-
Setting <span class=css data-link-type=maybe title=justify-content:center>justify-content:center</span> on the <a data-link-type=dfn href=#flex-container title="flex container">flex container</a>, however,
782-
would center it in the main axis.
797+
The effect of this is that if you set, for example,
798+
<a class=css data-link-type=propdesc href=#propdef-align-content title=align-content>align-content: center;</a> on an absolutely-positioned child of a <a data-link-type=dfn href=#flex-container title="flex container">flex container</a>,
799+
the child will be centered in the <a data-link-type=dfn href=#flex-container title="flex container’s">flex container’s</a> <a data-link-type=dfn href=#cross-axis title="cross axis">cross axis</a>.
800+
(The static position will be in the center of the <a data-link-type=dfn href=#cross-axis title="cross axis">cross axis</a>,
801+
and the child will align its center with the static position.)
783802
</div>
784803

785804
<h3 class="heading settled heading" data-level=4.2 id=item-margins><span class=secno>4.2 </span><span class=content>
@@ -959,8 +978,8 @@ <h3 class="heading settled heading" data-level=4.5 id=min-size-auto><span class=
959978

960979
<p>Otherwise,
961980
this keyword computes to <span class=css data-link-type=maybe title=0>0</span>
962-
(unless otherwise defined by a future specification).</p>
963-
</dl>
981+
(unless otherwise defined by a future specification).
982+
</dl><p></p>
964983

965984
<div class=note id=min-size-opt><a class=self-link href=#min-size-opt></a>
966985
<p>
@@ -2218,8 +2237,8 @@ <h3 class="heading settled heading" data-level=9.4 id=cross-sizing><span class=s
22182237
(even if it’s a multi-line flex container),
22192238
then clamp the line’s cross-size to be within the container’s computed min and max cross-size properties.
22202239
<span class=note>Note that if CSS 2.1’s definition of min/max-width/height applied more generally,
2221-
this behavior would fall out automatically.</span></p>
2222-
</ol>
2240+
this behavior would fall out automatically.</span>
2241+
</ol><p></p>
22232242

22242243

22252244
<li id=algo-line-stretch><a class=self-link href=#algo-line-stretch></a>
@@ -2393,13 +2412,13 @@ <h4 class="heading settled heading" data-level=9.7.1 id=resolve-flexible-lengths
23932412
the initial <a data-link-type=dfn href=#free-space title="free space">free space</a> multiplied by the item’s <a data-link-type=dfn href=#flex-grow-factor title="flex grow factor">flex grow factor</a>.</p>
23942413

23952414
<p>If the initial <a data-link-type=dfn href=#free-space title="free space">free space</a> is negative,
2396-
first find the <dfn data-dfn-type=dfn data-noexport="" id=scaled-flex-factor-sum>scaled flex factor sum<a class=self-link href=#scaled-flex-factor-sum></a></dfn>,</p>
2415+
first find the <dfn data-dfn-type=dfn data-noexport="" id=scaled-flex-factor-sum>scaled flex factor sum<a class=self-link href=#scaled-flex-factor-sum></a></dfn>,
23972416
<code>max(1, ∑unfrozen flex factors)</code>.
23982417
Then, for each unfrozen flex item,
23992418
find its <dfn data-dfn-type=dfn data-noexport="" id=scaled-flex-factor>scaled flex factor<a class=self-link href=#scaled-flex-factor></a></dfn> by multipling its <a data-link-type=dfn href=#flex-shrink-factor title="flex shrink factor">flex shrink factor</a> by its <a data-link-type=dfn href=#flex-base-size title="flex base size">flex base size</a>
24002419
and normalizing so that the sum of these <a data-link-type=dfn href=#scaled-flex-factor title="scaled flex factors">scaled flex factors</a> equals the <var>scaled flex factor sum</var>.
24012420
Then, multiply each item’s <a data-link-type=dfn href=#flex-shrink-factor title="flex shrink factor">flex shrink factor</a> by the initial <a data-link-type=dfn href=#free-space title="free space">free space</a>,
2402-
and let the result be its <a data-link-type=dfn href=#desired-free-space title="desired free space">desired free space</a>.
2421+
and let the result be its <a data-link-type=dfn href=#desired-free-space title="desired free space">desired free space</a>.</p>
24032422

24042423
<li>
24052424
<strong>Distribute <a data-link-type=dfn href=#free-space title="free space">free space</a>.</strong>

0 commit comments

Comments
 (0)