Skip to content

Commit ec0f736

Browse files
committed
Remove the section describing how to resolve flexible lengths, as its superfluous with the layout algorithm. Start replacing it with some examples of using flex().
1 parent 0ec0b01 commit ec0f736

2 files changed

Lines changed: 54 additions & 88 deletions

File tree

css3-flexbox/Overview.html

Lines changed: 29 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -210,9 +210,6 @@ <h2 class="no-num no-toc" id=table>Table of contents</h2>
210210
<ul class=toc>
211211
<li><a href="#flex-notation"><span class=secno>4.1. </span> The
212212
&lsquo;<code class=css>flex()</code>&rsquo; notation</a>
213-
214-
<li><a href="#resolving-flexible-lengths"><span class=secno>4.2. </span>
215-
Resolving Flexible Lengths</a>
216213
</ul>
217214

218215
<li><a href="#alignment"><span class=secno>5. </span> Alignment</a>
@@ -1117,71 +1114,42 @@ <h3 id=flex-notation><span class=secno>4.1. </span> The &lsquo;<code
11171114
positive and negative flexibility of zero and a preferred size of the
11181115
length.
11191116

1120-
<p class=issue>Examples!
1121-
11221117
<p class=issue>Transitioning to/from a &lt;length> (or to/from a &lt;flex>
11231118
with 0 flexibility) doesn't work well if it's the only flexible item in
11241119
the flexbox. Rather than smoothly transitioning, it suddenly jumps in size
11251120
when the flexibility becomes non-zero. Can we fix this, perhaps with a
11261121
value that represents a percentage of the free space or something?
11271122

1128-
<h3 id=resolving-flexible-lengths><span class=secno>4.2. </span> Resolving
1129-
Flexible Lengths</h3>
1130-
1131-
<p class=note>Note: This section is non-normative.
1132-
1133-
<p><a href="#flexible-length0"><i>Flexible lengths</i></a> are resolved
1134-
into normal, inflexible lengths by figuring out how large all of the <a
1135-
href="#flexible-length0"><i>flexible lengths</i></a> in the flexbox
1136-
<em>want</em> to be, then either growing or shrinking that <a
1137-
href="#preferred-size"><i>preferred size</i></a> so that the <a
1138-
href="#flexbox-item"><i>flexbox items</i></a> exactly fill the flexbox,
1139-
neither overflowing nor leaving extra unfilled space.
1140-
1141-
<p><a href="#flexible-length0"><i>Flexible lengths</i></a> are resolved
1142-
into normal inflexible lengths based on their <a
1143-
href="#preferred-size"><i>preferred size</i></a>, their flexibility, and
1144-
the amount of free space in the flexbox. The exact algorithm is described
1145-
in <a href="#layout-algorithm">a later section of this spec</a>, but in
1146-
general, it works like this:
1147-
1148-
<ol>
1149-
<li>First, set all the <a href="#flexible-length0"><i>flexible
1150-
lengths</i></a> to their <a href="#preferred-size"><i>preferred
1151-
size</i></a>.
1152-
1153-
<li>Then, lay out the flexbox, and see if there is free space left, or if
1154-
the flexbox is overflowing.
1155-
1156-
<li>If there's free space, distribute it among the <a
1157-
href="#flexible-length0"><i>flexible lengths</i></a> in proportion to
1158-
their <a href="#positive-flexibility"><i>positive flexibility</i></a>. If
1159-
the flexbox is overflowing, shrink the <a
1160-
href="#flexible-length0"><i>flexible lengths</i></a> in proportion to
1161-
their <a href="#negative-flexibility"><i>negative flexibility</i></a>.
1162-
1163-
<li>If there's free space and any <a href="#flexible-length0"><i>flexible
1164-
lengths</i></a> are violating a max width or height constraint, change
1165-
them into the largest inflexible length that doesn't violate their
1166-
constraint and return to step 2. If the flexbox is overflowing and any <a
1167-
href="#flexible-length0"><i>flexible lengths</i></a> are violating a min
1168-
width or height constraint, change them into the smallest inflexible
1169-
length that doesn't violate their constraint and return to step 2.
1170-
1171-
<li>If there's free space and any <a href="#flexible-length0"><i>flexible
1172-
lengths</i></a> are violating a min width or height constraint, change
1173-
them into the smallest inflexible length that doesn't violate their
1174-
constraint and return to step 2. If the flexbox is overflowing and any <a
1175-
href="#flexible-length0"><i>flexible lengths</i></a> are violating a max
1176-
width or height constraint, change them into the largest inflexible
1177-
length that doesn't violate their constraint and return to step 2.
1178-
</ol>
1179-
1180-
<p class=issue>This is too much detail for a non-normative section. This is
1181-
living here only until I flesh out the layout algorithm section. Then this
1182-
can return to being a fairly simple explanation of what goes on.
1123+
<div class=example>
1124+
<p>The &lsquo;<code class=css>flex()</code>&rsquo; notation allows
1125+
elements to respond directly to the available space, in ways that are
1126+
difficult or impossible in normal CSS. One common example is a page with
1127+
one segment intended to stay on screen, and another section which may be
1128+
long but which shouldn't scroll the page, like a chat room:</p>
11831129

1184-
<p class=issue>Examples!
1130+
<pre>
1131+
&lt;!DOCTYPE html>
1132+
&lt;body>
1133+
&lt;header>Channel: #csswg Topic: CSS IS AWE SOME&lt;/header>
1134+
&lt;article id='messages'>
1135+
&lt;p>&lt;b>Tab Atkins:&lt;/b>
1136+
I think the layout algorithm is done.&lt;/p>
1137+
&lt;p>&lt;b>Fantasai:&lt;/b>
1138+
SUBMIT BEFORE ZOD.&lt;/p>
1139+
...
1140+
&lt;/article>
1141+
&lt;form>
1142+
&lt;input name='message'>
1143+
&lt;button type='submit'>Send&lt;/button>
1144+
&lt;/form>
1145+
&lt;/body>
1146+
&lt;style>
1147+
body { display:flexbox; flex-flow: column; }
1148+
#messages { height: flex(1); }
1149+
&lt;/style></pre>
1150+
1151+
<p class=issue>Illustrate this example.</p>
1152+
</div>
11851153

11861154
<h2 id=alignment><span class=secno>5. </span> Alignment</h2>
11871155

css3-flexbox/Overview.src.html

Lines changed: 25 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -516,36 +516,34 @@ <h3 id='flex-notation'>
516516

517517
<p>A ''&lt;flex>'' value is transitionable, by transitioning the <i>preferred size</i>, <i>positive flexibility</i>, and <i>negative flexibility</i> independently. ''&lt;flex>'' can also transition to and from a &lt;length>, by treating the length as if it were a flexible length with a positive and negative flexibility of zero and a preferred size of the length.</p>
518518

519-
<p class='issue'>Examples!</p>
520-
521519
<p class='issue'>Transitioning to/from a &lt;length> (or to/from a &lt;flex> with 0 flexibility) doesn't work well if it's the only flexible item in the flexbox. Rather than smoothly transitioning, it suddenly jumps in size when the flexibility becomes non-zero. Can we fix this, perhaps with a value that represents a percentage of the free space or something?</p>
522520

521+
<div class='example'>
522+
<p>The ''flex()'' notation allows elements to respond directly to the available space, in ways that are difficult or impossible in normal CSS. One common example is a page with one segment intended to stay on screen, and another section which may be long but which shouldn't scroll the page, like a chat room:</p>
523523

524-
<h3 id='resolving-flexible-lengths'>
525-
Resolving Flexible Lengths</h3>
526-
527-
<p class='note'>Note: This section is non-normative.</p>
528-
529-
<p><i>Flexible lengths</i> are resolved into normal, inflexible lengths by figuring out how large all of the <i>flexible lengths</i> in the flexbox <em>want</em> to be, then either growing or shrinking that <i>preferred size</i> so that the <i>flexbox items</i> exactly fill the flexbox, neither overflowing nor leaving extra unfilled space.</p>
530-
531-
<p><i>Flexible lengths</i> are resolved into normal inflexible lengths based on their <i>preferred size</i>, their flexibility, and the amount of free space in the flexbox. The exact algorithm is described in <a href="#layout-algorithm">a later section of this spec</a>, but in general, it works like this:</p>
532-
533-
<ol>
534-
<li>First, set all the <i>flexible lengths</i> to their <i>preferred size</i>.</li>
535-
536-
<li>Then, lay out the flexbox, and see if there is free space left, or if the flexbox is overflowing.</li>
537-
538-
<li>If there's free space, distribute it among the <i>flexible lengths</i> in proportion to their <i>positive flexibility</i>. If the flexbox is overflowing, shrink the <i>flexible lengths</i> in proportion to their <i>negative flexibility</i>.</li>
539-
540-
<li>If there's free space and any <i>flexible lengths</i> are violating a max width or height constraint, change them into the largest inflexible length that doesn't violate their constraint and return to step 2. If the flexbox is overflowing and any <i>flexible lengths</i> are violating a min width or height constraint, change them into the smallest inflexible length that doesn't violate their constraint and return to step 2.</li>
541-
542-
<li>If there's free space and any <i>flexible lengths</i> are violating a min width or height constraint, change them into the smallest inflexible length that doesn't violate their constraint and return to step 2. If the flexbox is overflowing and any <i>flexible lengths</i> are violating a max width or height constraint, change them into the largest inflexible length that doesn't violate their constraint and return to step 2.</li>
543-
</ol>
544-
545-
<p class='issue'>This is too much detail for a non-normative section. This is living here only until I flesh out the layout algorithm section. Then this can return to being a fairly simple explanation of what goes on.</p>
546-
547-
<p class='issue'>Examples!</p>
548-
524+
<pre>
525+
&lt;!DOCTYPE html>
526+
&lt;body>
527+
&lt;header>Channel: #csswg Topic: CSS IS AWE SOME&lt;/header>
528+
&lt;article id='messages'>
529+
&lt;p>&lt;b>Tab Atkins:&lt;/b>
530+
I think the layout algorithm is done.&lt;/p>
531+
&lt;p>&lt;b>Fantasai:&lt;/b>
532+
SUBMIT BEFORE ZOD.&lt;/p>
533+
...
534+
&lt;/article>
535+
&lt;form>
536+
&lt;input name='message'>
537+
&lt;button type='submit'>Send&lt;/button>
538+
&lt;/form>
539+
&lt;/body>
540+
&lt;style>
541+
body { display:flexbox; flex-flow: column; }
542+
#messages { height: flex(1); }
543+
&lt;/style></pre>
544+
545+
<p class='issue'>Illustrate this example.</p>
546+
</div>
549547

550548
<h2 id='alignment'>
551549
Alignment</h2>

0 commit comments

Comments
 (0)