Skip to content

Commit ee40413

Browse files
committed
Editorial work on collapsed items section; align terminology with CSS2.1, add some better explanations.
1 parent af65775 commit ee40413

2 files changed

Lines changed: 59 additions & 53 deletions

File tree

css3-flexbox/Overview.html

Lines changed: 36 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -731,40 +731,41 @@ <h3 id=abspos-flex-items><span class=secno>4.2. </span> Out-of-flow Items</h3>
731731

732732
<h3 id=visibility-collapse><span class=secno>4.3. </span> Collapsed Items</h3>
733733

734-
<p> Using ‘<code class=css>visibility:collapse</code>’ on a flex item
735-
produces an effect similar to ‘<code
736-
class=css>visibility:collapse</code>’ on a table-row or table-column;
737-
the collapsed element is removed from rendering entirely (like it was
738-
<code class=css>display:none</code>’), but it leaves behind a "strut"
739-
that helps keep the flex container's layout stable. If a flex container
740-
has only one line (whether it's <a
741-
href="#single-line"><i>single-line</i></a> or <a
742-
href="#multi-line"><i>multi-line</i></a>), dynamically collapsing or
743-
uncollapsing items is guaranteed to have no effect on the flex container's
744-
<a href="#cross-size"><i>cross size</i></a>, so it won't cause the rest of
745-
your page's layout to "wobble". (A flex container with multiple lines may
746-
or may not benefit from this effect, depending on exactly how it is laid
747-
out.)
748-
749-
<p> Though collapsed flex items aren't rendered, they still generate a box.
750-
(Only ‘<code class=css>display:none</code>’ actually prevents an
751-
element from generating a box.) As such, some effects that depend on an
752-
element having a box (like incrementing counters or running animations and
753-
transitions) still work on collapsed items, unlike ‘<code
754-
class=css>display:none</code>’ items.
734+
<p> Specifying ‘<code class=css>visibility:collapse</code>’ on a flex
735+
item causes it to become a <dfn id=collapsed-flex-item
736+
title="collapsed flex item|collapsed">collapsed flex item</dfn>, producing
737+
an effect similar to ‘<code class=css>visibility:collapse</code>’ on a
738+
table-row or table-column: the collapsed element is removed from rendering
739+
entirely, but leaves behind a "strut" that keeps the flex line's
740+
cross-size stable. Thus, if a flex container has only one flex line,
741+
dynamically collapsing or uncollapsing items is guaranteed to have no
742+
effect on the flex container's <a href="#cross-size"><i>cross size</i></a>
743+
and won't cause the rest of the page's layout to "wobble". Flex line
744+
wrapping <em>is</em> re-done after collapsing, however, so the cross-size
745+
of a flex container with multiple lines might or might not change.
746+
747+
<p> Though collapsed flex items aren't rendered, they do appear in the <a
748+
href="http://www.w3.org/TR/CSS21/intro.html#formatting-structure">formatting
749+
struture</a>. Therefore, unlike on ‘<code
750+
class=css>display:none</code>’ items <a href="#CSS21"
751+
rel=biblioentry>[CSS21]<!--{{!CSS21}}--></a>, effects that depend on an
752+
element appearing in the formatting structure (like incrementing counters
753+
or running animations and transitions) still operate on collapsed items.
754+
755+
<p> To compute the size of the strut, flex layout is first performed with
756+
all items uncollapsed, and then re-run with each collapsed item replaced
757+
by a strut that maintains the original cross-size of the item's original
758+
line. See the <a href="#layout-algorithm">Flex Layout Algorithm</a> for
759+
the normative definition of how ‘<code
760+
class=css>visibility:collapse</code>’ interacts with flex layout.
755761

756762
<p class=note> Note that using ‘<code
757763
class=css>visibility:collapse</code>’ on any flex items will cause the
758764
flex layout algorithm to repeat partway through, re-running the most
759765
expensive steps. It's recommended that authors continue to use ‘<code
760-
class=css>display:none</code>’ to hide items if the special effects of
761-
<code class=css>visibility:collapse</code>’ aren't explicitly
762-
required, as that is more efficient for the layout engine.
763-
764-
<p> The normative definition of how ‘<code
765-
class=css>visibility:collapse</code>’ interacts with the flex layout
766-
algorithm is defined <a href="#layout-algorithm">later in this
767-
specification</a>.
766+
class=css>display:none</code>’ to hide items if the items will not be
767+
dynamically collapsed and uncollapsed, as that is more efficient for the
768+
layout engine.
768769

769770
<h3 id=min-size-auto><span class=secno>4.4. </span> Implied Minimum Size of
770771
Flex Items</h3>
@@ -3519,6 +3520,12 @@ <h2 class=no-num id=index>Index</h2>
35193520
title="''center''"><strong>8.4.</strong></a>, <a href="#flex-pack-center"
35203521
title="''center''"><strong>8.2.</strong></a>
35213522

3523+
<li>collapsed, <a href="#collapsed-flex-item"
3524+
title=collapsed><strong>4.3.</strong></a>
3525+
3526+
<li>collapsed flex item, <a href="#collapsed-flex-item"
3527+
title="collapsed flex item"><strong>4.3.</strong></a>
3528+
35223529
<li><a href="#flex-flow-column"><code class=css>column</code></a>’,
35233530
<a href="#flex-flow-column" title="''column''"><strong>5.1.</strong></a>
35243531

css3-flexbox/Overview.src.html

Lines changed: 23 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -415,43 +415,42 @@ <h3 id='visibility-collapse'>
415415
Collapsed Items</h3>
416416

417417
<p>
418-
Using ''visibility:collapse'' on a flex item
419-
produces an effect similar to ''visibility:collapse'' on a table-row or table-column;
420-
the collapsed element is removed from rendering entirely
421-
(like it was ''display:none''),
422-
but it leaves behind a "strut" that helps keep the flex container's layout stable.
423-
If a flex container has only one line
424-
(whether it's <i>single-line</i> or <i>multi-line</i>),
418+
Specifying ''visibility:collapse'' on a flex item
419+
causes it to become a <dfn title="collapsed flex item|collapsed">collapsed flex item</dfn>,
420+
producing an effect similar to ''visibility:collapse'' on a table-row or table-column:
421+
the collapsed element is removed from rendering entirely,
422+
but leaves behind a "strut" that keeps the flex line's cross-size stable.
423+
Thus, if a flex container has only one flex line,
425424
dynamically collapsing or uncollapsing items
426-
is guaranteed to have no effect on the flex container's <i>cross size</i>,
427-
so it won't cause the rest of your page's layout to "wobble".
428-
(A flex container with multiple lines may or may not benefit from this effect,
429-
depending on exactly how it is laid out.)
425+
is guaranteed to have no effect on the flex container's <i>cross size</i>
426+
and won't cause the rest of the page's layout to "wobble".
427+
Flex line wrapping <em>is</em> re-done after collapsing, however,
428+
so the cross-size of a flex container with multiple lines might or might not change.
430429

431430
<p>
432431
Though collapsed flex items aren't rendered,
433-
they still generate a box.
434-
(Only ''display:none'' actually prevents an element from generating a box.)
435-
As such,
436-
some effects that depend on an element having a box
432+
they do appear in the <a href="http://www.w3.org/TR/CSS21/intro.html#formatting-structure">formatting struture</a>.
433+
Therefore, unlike on ''display:none'' items [[!CSS21]],
434+
effects that depend on an element appearing in the formatting structure
437435
(like incrementing counters or running animations and transitions)
438-
still work on collapsed items,
439-
unlike ''display:none'' items.
436+
still operate on collapsed items.
437+
438+
<p>
439+
To compute the size of the strut, flex layout is first performed with all items uncollapsed,
440+
and then re-run with each collapsed item replaced by a strut that maintains
441+
the original cross-size of the item's original line.
442+
See the <a href="#layout-algorithm">Flex Layout Algorithm</a>
443+
for the normative definition of how ''visibility:collapse''
444+
interacts with flex layout.
440445

441446
<p class='note'>
442447
Note that using ''visibility:collapse'' on any flex items
443448
will cause the flex layout algorithm to repeat partway through,
444449
re-running the most expensive steps.
445450
It's recommended that authors continue to use ''display:none'' to hide items
446-
if the special effects of ''visibility:collapse'' aren't explicitly required,
451+
if the items will not be dynamically collapsed and uncollapsed,
447452
as that is more efficient for the layout engine.
448453

449-
<p>
450-
The normative definition of how ''visibility:collapse''
451-
interacts with the flex layout algorithm
452-
is defined <a href="#layout-algorithm">later in this specification</a>.
453-
454-
455454
<h3 id='min-size-auto'>
456455
Implied Minimum Size of Flex Items</h3>
457456

0 commit comments

Comments
 (0)