Re: [css3-flexbox] Proposal for collapsing box elements depending on containing box size

On Fri, Jul 31, 2009 at 1:14 PM, James Elmore<James.Elmore@cox.net> wrote:
> Pierre d'Herbemont wrote a long and interesting proposal. Rather than repeat
> it, please see the grandparent of this message.
>
> On Jul 31, 2009, at 6:31 AM, Tab Atkins Jr. wrote:
>>
>> I like it.   Two comments:
>>
>> 1. I would prefer a keyword to indicate that a box isn't collapsible,
>> rather than hijacking the value 0 for that.  It doesn't make sense
>> that 1 collapses before 2, but 0 never collapses at all.  As all
>> elements are non-collapsible by default, just having "auto" be the
>> non-collapse value will work.
>> ~TJ
>>
>
> If I understand (and I'm not sure that I do) this proposal extends box-flex
> so that some boxes can 'collapse' and disappear. I would prefer to see
> controls on the box-flex so it is better integrated into the flex concepts.
>
> For example, boxes could:
>
> 1. expand and shrink with the flex;
> 2. expand only, never shrinking below 'min';
> 3. shrink only, never expanding beyond 'max';

These three are already present within the current draft of the flexbox spec.

> 4. maintain their sizes, but 'collapse' completely when they don't fit (I
> hope I understood the original correctly);

Yes, this would be achieved with Pierre's proposal by setting
box-collapse-priority but not box-flex.

> 5. expand and shrink with the flex, but 'collapse' when space is limited.

And this is what you get when both box-collapse-priority and box-flex are set.

> Additionally, boxes might (should) indicate missing material. As text uses
> an ellipsis (...) when some characters / words do not fit on a screen and do
> not overflow, something similar for 'collapsed' or 'missing' boxes or other
> elements could be very useful.

That's an interesting idea - allowing collapsed boxes to indicate that
they're collapsed with a reduced-size marker.  Presumably multiple
adjacent boxes who have all collapsed would share a marker.

I'd probably make it a pseudoelement on the parent.  You'd set
properties, content, etc on the ::collapse-box pseudoelement and any
children of the box which collapse get replaced by that pseudoelement.
 Adjacent boxes that collapse display only a single ::collapsed-box.

So given a setup like this:
+-#parent-----------------------------+
| +-+ +-+ +-+ +-+ +-+ +-+ +-+ +-+ +-+ |
| |1| |2| |3| |4| |5| |6| |7| |8| |9| |
| +-+ +-+ +-+ +-+ +-+ +-+ +-+ +-+ +-+ |
+-------------------------------------+
And CSS like:
#parent { display: box; }
#parent::collapsed-box { display: box; content: "..."; color: silver; }

Then if all the even-numbered children collapsed, you'd have four
separate ::collapsed-box pseudoelements gets inserted between each
odd-number pair.  If children 2-8 all collapsed, you'd have a *single*
::collapsed-box pseudoelement inserted between child 1 and 9.

> Keywords and values (akin to the 'flex' values) could indicate the amount of
> 'flex' both for expansion and shrinking, and collapse.

That's part of the current flexbox spec.  I'm not sure I understand
what you're suggesting here - you seem to be saying that a new set of
flex values would be needed for some reason, in addition to the
standard flex values.

~TJ

Received on Friday, 31 July 2009 20:05:19 UTC