W3C home > Mailing lists > Public > www-style@w3.org > January 2016

Re: [css-grid] Resolve Intrinsic Track Sizes: min-content vs auto minimums

From: Manuel Rego Casasnovas <rego@igalia.com>
Date: Thu, 21 Jan 2016 13:38:51 +0100
To: www-style@w3.org
Message-ID: <56A0D15B.5070609@igalia.com>

On 21/01/16 04:30, fantasai wrote:
> If all items in a grid track have 'width: auto; min-width: auto'
> then an 'auto' track size will result in the same base track size
> as 'min-content'.

Ok, that's case 1) from my previous mail:

> If all items in a grid track have 'width: auto; min-width: 0',
> then an 'auto' track size will result in a base track size of 0.

I agree with this, and that's what I said for case 3) (in that mail).
But it seems you were thinking in something different in your last mail:

> Furthermore, 'min-width: auto' items with a specified width less
> than their min-content size will be treated as contributing their
> specified width to an 'auto' track, not their min-content size.
> (If the min-width or track size was min-content, then they would
> instead contribute their min-content size.)

Sorry but I don't understand this part.

Let me see if I got it right with a new example.
We've the following grid:
 <div style="display: grid; width: min-content; font: 25px/1 Ahem;">
   <div style="width: 50px; min-width: auto;">XXXX XX</div>

So the min-content for the item is 100px, but it has a specified width
of 50px.

You said that the size of the track should be:
A) grid-template-columns: auto;        => Column's width:  50px;
B) grid-template-columns: min-content; => Column's width: 100px;

And this seems really weird to me.
IMHO, B) should be 50px too.

Let's use an example of a regular block, not grid involved:
  <div style="width: min-content; font: 25px/1 Ahem;">
    <div style="width: 50px;">XXXX XX</div>

The width of both divs here is 50px. Because of the min-content
contribution of the item is 50px.

Why in a grid track sized with "min-content" we should change this?

Note that even if we decide that the track is 100px, the item will have
50px width.
Because of it has "min-width: auto", and from the spec the minimum size
would be [1]:
  min(specified size, content size)
Which is:
  min(50px, 100px)


[1] https://drafts.csswg.org/css-grid/#min-size-auto
Received on Thursday, 21 January 2016 12:39:33 UTC

This archive was generated by hypermail 2.4.0 : Friday, 25 March 2022 10:08:59 UTC