Re: [css-flexbox] Horizontal layout containment of inline text

On Tue, Jan 6, 2015 at 7:39 PM, Bruno Racineux <bruno@hexanet.net> wrote:
> I have been commenting/helping on a stackoverflow use case [1] which is an
> attempt to do an horizontal size determination of a flex item based on
> inline text content only and using columns, with a height constraint but no
> given width constraint.
>
> Just wondering if that's a case Flex could technically handle given the
> existing spec?
>
> This is my assessment so far illustrating the browser differences and
> inaccurate width determinations:
> http://stackoverflow.com/a/27777013/1647538
>
> Or is there a possible nested Flex configuration that could make this use
> case work I am missing?
>
> [1]
> http://stackoverflow.com/questions/27694966/make-a-div-containing-css-columns-have-unlimited-width/27777013#27777013

This isn't quite possible to do in CSS right now.  The problem, as
noted in the Stack Overflow, is that the main content will be limited
to the width of the viewport, and then start overflowing.  This is
because normal layout assumes that the inline dimension will always
have a finite containing-block size.  At the limit, you run into the
initial containing block, which has dimensions equal to the viewport.

You'd need to flip around some of the assumptions of CSS and make it
possible to lay things out into infinite inline space, without
invoking the rescue behavior from Writing Modes that caps you at the
viewport size again.  (This is to help prevent orthogonal-direction
content from accidentally laying out in one gigantic line and causing
the "wrong" kind of scrolling.  That's quite a bit of involved work.
^_^

A less-involved bit of work would be to have a 'width' keyword that
had special behavior for multicol elements; if they had a definite
height, it would set the width to the result of doing multicol layout
accordingly (it would presumably be equivalent to 'auto' in all other
circumstances).  That would *not* be a ton of work, and would solve
the problem in the SO post.  However, it's probably also low-value,
since most of the time you don't want things to scroll horizontally at
all.

~TJ

Received on Friday, 9 January 2015 23:56:56 UTC