W3C home > Mailing lists > Public > www-style@w3.org > June 2016

Re: [css-containment] Splitting size into width and height

From: Martin Auswöger <martin@auswoeger.com>
Date: Mon, 20 Jun 2016 16:41:39 +0200
Message-Id: <D298B959-49D4-4A60-850C-6091D30E392F@auswoeger.com>
To: Ojan Vafai <ojan@chromium.org>, www-style@w3.org
> 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).
Received on Monday, 20 June 2016 14:42:11 UTC

This archive was generated by hypermail 2.4.0 : Friday, 25 March 2022 10:09:03 UTC