Fwd: [css-grid] question on clamping grid items to fixed track size

Forwarding off-list discussion to www-archive for future reference.
Swapping out identity to help keep quotations straight...

-------- Forwarded Message --------
Subject: [css-grid] question on clamping grid items to fixed track size
Date: Mon, 12 Feb 2018 04:06:16 +0100
From: Mats Palmgren
To: fantasai

Hello Elika,

Sorry for intruding but I have a question about the Grid spec that I think
is important enough to reach out directly to confirm I understand the spec
correctly.  Here's an example to illustrate:

<style type="text/css">
.grid {
   display: inline-grid;
   grid-template-columns: minmax(auto, 0px);
   border: 2px solid blue;
   margin-bottom: 2px;
}

.grid div {
   background: grey;
   width: 20px;
   height: 10px;
}
</style>

<div class="grid">
   <div></div>
</div>

As I understand it, the grid item width, column size, and grid container
width should all be zero in this case.  Is this correct?

The text about clamping grid items in §6.6 says:
"... its specified size and content size in that dimension (and the input
to the transferred size in the other dimension) are further clamped ..."
https://drafts.csswg.org/css-grid/#min-size-auto

20px qualifies as a "specified size" here and should be clamped to zero.

I'm assuming that the clamping in §6.6 occurs regardless of whether
we're sizing the grid container under a min-content constraint,
max-content constraint, or no constraint.  Is this correct?

I'm also assuming that the clamping in §6.6 occurs regardless of the value
of justify-/align-self.  Is this correct?

(I'm working on https://bugzilla.mozilla.org/show_bug.cgi?id=1427608
and I find that Chrome also has bugs in this area.)


Thanks,
Mats

Received on Monday, 26 March 2018 19:45:42 UTC