Re: [css-containment] Splitting size into width and height
Martin Auswöger <[email protected]> Mon, 20 Jun 2016 16:41:39 +0200
| Newsgroups | gmane.comp.web.css.general |
|---|---|
| Message-ID | <[email protected]> |
> Do you have a case of wanting width/height containment but not wanting to also set a definite width/height value? Yes, I think this would be the case for most container query use cases. Usually you want a container with a width that is independent of its descendants and a height that depends on the descendants. This way you can query the width of the container and style its children accordingly without the risk of creating loops. The problem with the width and height properties is, that they don’t define alone if the size is descendants-dependent or not. E.g. `display: block; width: auto` is usually independent of descendants but not if it’s inside a `float: left` or `display: flex` element. Even a definite size like `width: 100px` could get descendants-dependent if it’s for example inside a `display: flex` element and has `flex-basis: 0%`. The rules get very complex and hard to detect, whereas checking if `contain: width` is set on a specific element would be very easy (via JavaScript).