Re: [csswg-drafts] [css-anchor-1] Area-specific styling (#9332)

The more I thought about it, the more, in my opinion, something container-query-like could be the best.

If children of an absolutely positioned element could query that element's position, we would be able to style them in any way we'd want (we'd need to have some containment on the element, though, I imagine? Which is usually ok for absolutely positioned elements).

This way, we could cover both area-specific styling and a more low-level anchor positioning if we somehow query any anchors' values:

1. If we have area-specific styling with or without fallbacks, we could query which quadrant(s) our element is currently positioned into. Something like “is our popover in its block-start position?” or “is it in both block-start and inline-end”?

2. If we have regular absolute positioning with anchors, what I'd want to test is something like “is `inset-block-start` of element1 smaller than `inset-block-start` of element2?”, basically, manually querying `anchor()` and `anchor-size()` and comparing them.

The main limitation of this is that we would have to have the containment on our absolutely positioned element, so the styles of children won't affect the positioning, so if we'd want our popover to visually collapse to content, that would have to happen on an element _inside_ our popover, which can be a bit cumbersome. Unless we'd find a way to make it just work in some way?

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


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

Received on Sunday, 10 September 2023 22:12:52 UTC