Re: [csswg-drafts] [css-contain-1] do we need layout containment in a single dimension to enable container queries?

> I wonder if this can be solved by making `size-x` work only when there's a specified width that does not depend on the parent (i.e. no `auto`, no `available`, no `fit-content`, no percentage). … Not sure it is still sufficiently useful though.

This would work I think, but it would not be useful for container query scripts anymore.

> I believe the problem is exclusively caused by an ancestor having auto scrollbars

Unfortunately, I don’t think scrollbars are the only case this could happen. Take for example this code of a `contain: size-y` example ([CodePen](https://codepen.io/anon/pen/aYQLvV?editors=1100)):

```html
<div class="parent">
  <div class="inner">
    <div class="child"></div>
  </div>
</div>
<style>
  .parent {
    float: left; /* this makes the width depend on its contents */
    height: 100px;
  }
  .inner {
    padding-top: 10%; /* this percentage is relative to the width */
    height: 100%;
  }
  .child {
    height: 100%;
    contain: size-y; /* would not work in this case */
  }
</style>
```

> (2d also? not sure)

Two-dimensional `contain: size` is not affected because its specified behavior is *“When laying out the containing element, it must be treated as having no contents.”*

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

Received on Saturday, 7 April 2018 11:42:20 UTC