W3C home > Mailing lists > Public > www-style@w3.org > August 2014

Re: Auto margins and shrinkwrapping [css-flexbox][css-grid][css-writing-modes]

From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Mon, 18 Aug 2014 19:20:41 -0700
Message-ID: <CAAWBYDB7mtDSBzhJ+R0dsfFNK7cRe6O8gkUMPgEJfWonA9RXqQ@mail.gmail.com>
To: fantasai <fantasai.lists@inkedblade.net>
Cc: "www-style@w3.org" <www-style@w3.org>
On Fri, Jul 25, 2014 at 12:12 PM, fantasai
<fantasai.lists@inkedblade.net> wrote:
> (This is mostly a note to myself.)
>
> Issue is wrt auto margins. Note: Margins default to zero.
>
> For auto-sized items, a block-level block will fill its containing
> block in the inline dimension. Setting margins to auto has no effect,
> it's just like having zero margins. If you make the block smaller
> than the containing block by setting an explicit width (or turning
> it into a table), then it can be aligned with auto margins.
>
> In flex and grid layout, if you have at least one auto margin, the
> item shrinkwraps. Therefore, if its content is smaller than the
> container, it can be margin-aligned.
>
> I can't remember what we do with block-level grid and flex containers.
> I think we should make them shrinkwrap if either margin is zero,
> because that would be useful and make sense and the current behavior
> is easy to get by *not doing anything* and getting the default margins
> of zero.
>
> This also shows up in orthogonal flows. Currently trying to unravel
> that as well, and came to this conclusion, that they should shrinkwrap
> if a margin is auto and fill-available otherwise.

fantasai and I just looked into this, and since implementations all
treat inline auto margins as zero, concluded that we shouldn't try to
change behavior here.

However, we do plan on having the alignment keywords do
shrinkwrapping, as they do currently in Flexbox and Grid.  You could
say "justify-self: end;" on an element in a block layout context to
get it to shinkwrap and right-align (in ltr page, of course).

~TJ
Received on Tuesday, 19 August 2014 02:21:29 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 19 August 2014 02:21:29 UTC