Re: [csswg-drafts] [css-grid] grid-template-width and grid-template-height (#9182)

`::contents` pseudo element looks great but there are some overlaping features like `margin:auto` and `justify-content`.

> grid-template-columns: 1fr would typically grow to fill the provided grid-template-width and avoid conflicts, but there could be an item that forces the track to become bigger.

I can see this problem with `::contents` too, because you can define a width or max-width conflicting with the template width (or the element width itself). For example:

```css
.element {
  width: 300px;
}
.element::contents {
  display: block;
  width: 200px;
}
```

I think a new single property with a good definition and narrow scope is better than creating a new element with limitless combinations.

> I don't like your proposal because it's grid-specific, but a similar thing could be wanted in e.g. flex or block.

That's fair. Maybe changing the name to be more generic? For example `content-width` or `content-auto-width` (to indicate that this width has only effects to elements when elements with auto widths are present ( like `flex-grow`, `fr`, etc).


-- 
GitHub Notification of comment by oscarotero
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/9182#issuecomment-2017720534 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Monday, 25 March 2024 10:52:28 UTC