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

> For that kind of fallback, just make it possible to query for a given container type?
> 
> ```css
> p { padding: 1em; }
> 
> @container (inline-size) {
>    p { padding: 10cw; }
> }
> ```

@andruud This ensures that that there is a proper container for the unit, but it doesn't ensure it's the _nearest ancestor_ container referenced by the unit. We would still need to say that units evaluate against the nearest container _of the appropriate type_. And that puts us back in a situation where units could evaluate against multiple containers:

```html
<div style="container: size;>
  <div style="container: block-size;>
    <div style="container: inline-size;>
      <div style="container: style;>
        <p>how do container units evaluate on this paragraph?</p>
      </div>
    </div>
  </div>
</div>
```

Which container is used for the various units?

```css
p {
  /*  style (nearest)? block-size (of-type)? */
  margin: 1qb;

  /*  style (nearest)? inline-size (of-type)? */
  padding: 1qi;

  /*  style (nearest)? size (of-type)? or inline-size & block-size, individually per axis? */
  font-size: 1qmax;
}
</style>
```


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


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

Received on Thursday, 17 June 2021 20:01:01 UTC