Re: [csswg-drafts] [css-contain-3] "container width" and "container height" units (#5888)

@andruud lol, _no mercy_.

If I were to do something like this now, without container queries, I would likely set eg `--qi` and `--qb` custom properties on each container with inline or block containment respectively, using JS. Then I would inherit them, and determine the other units from there: 

```css
[data-container~="inline-size"],
[data-container~="size"] {
  --qi: <set via JS>;
}

[data-container~="block-size"],
[data-container~="size"] {
  --qb: <set via JS>;
}

[data-container] * {
  --qmin: min(var(--qi, 0), var(--qb, 0));
  --qmax: max(var(--qi, 0), var(--qb, 0));
}
```

When I think of it that way - it doesn't bother me that the two dimensions might come from different containers. I feel like each unit represents the best info we have about the given axis. So that's making me lean towards doing unit container selection for each axis individually, as though `qi` represents `@container type(inline-size)` and `qb` represents `@container type(block-size)`, and the other units are derived from those.

Then we only need the (merciless) fallback when there is no container in the requested dimension.

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


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

Received on Friday, 18 June 2021 17:18:06 UTC