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

That's a different question, but OK, how about making the units evaluate against the [selected container](https://drafts.csswg.org/css-contain-3/#container-rule) (see "container selection process") for the container-query/element pair?

```CSS
/* (Syntax borrowed from https://github.com/w3c/csswg-drafts/issues/6393). */
@container type(inline-size) {
   p { padding: 1qi; }
}
```
Here `qi` evaluates against whatever is the current selected container is for the matched element. This way authors have full flexibility.

Otherwise, if there is no enclosing `@container` rule, it evaluates against the nearest container (no mercy).

Worse ideas:

- A function which can be used to select the container explicitly? `calc(1 * qi(<selection>))` (beautiful).
- Custom units and an API to define them?

-- 
GitHub Notification of comment by andruud
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/5888#issuecomment-863854106 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 08:19:13 UTC