Skip to content

[css-grid][css-contain] Clarify that contain:size affects track sizing #4931

@MatsPalmgren

Description

@MatsPalmgren

Consider the following case:

<div style="display:inline-grid; contain:size;">
  <item style="background:red">Hello Kitty</item>
</div>

My understanding of the CSS Containment spec is that the intent of contain:size is that all size calculations should be done as if the element has no children:
https://drafts.csswg.org/css-contain/#containment-size
Chromium and Gecko agrees that the content-box size in the above case is 0x0, which is correct. I tend to think that the track sizes also should be zero and thus that it should render the same as:

<div style="display:inline-grid; grid:0/0;">
  <item style="background:red">Hello Kitty</item>
</div>

Neither Chromium nor Gecko does that currently, but I intend to fix this in Gecko (bug 1488878).

I can't find any spec text dealing with this case explicitly though, so I would like CSS Grid to clarify that when the Grid container has contain:size the Track Sizing Algorithm should be run as if the container has no items. This will have the effect that any intrinsic track sizes will be zero.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions