- From: Francisco Ryan Tolmasky I via GitHub <sysbot+gh@w3.org>
- Date: Fri, 29 Dec 2023 18:23:26 +0000
- To: public-css-archive@w3.org
> You just need to set appropriate container-* properties, not a container query. And soon (much sooner than inherit() may ship) you'll be able to refer to containers higher than the closest one. inherit() will not do what you want most of the time, because it would only give you a parent width/height, and only if it's explicitly set, which it usually is not. Whereas cq units will actually be computed based on the used dimensions. I guess there are actually two issues here: 1. In the specific `padding` case that I was originally trying to solve, it occurs to me that both this inheritance stuff and the container query approach doesn't really do what I need, since `padding` percentages are based off of the current element's size, and not the parent. So what I really want is just a new units like `%w` and `%h`, to differentiate between the width and height when referring to percentages. That way I could just do something like `padding: 10%h 10%w`. Should I open a new issue to discuss that specifically? 2. When wanting to refer to a parent's size, it still feels like it would be useful to have something like `%h` and `%w`, since it seems that specifying the `container-` properties potentially signs you up for additional behavior than you bargained for, including, potentially, performance implications? I ask because percentages seem to get away with providing access to parent size information (with limitations), without having to formally denote something as a container (in other words, they'll work with "any" parent, when it makes sense), and theoretically without any additional performance implications. In other words, `height: 10%h` would work in all circumstances that `height: 10%` works, including when it is effectively ignored. -- GitHub Notification of comment by tolmasky Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/2864#issuecomment-1872261561 using your GitHub account -- Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config
Received on Friday, 29 December 2023 18:23:28 UTC