[csswg-drafts] [css-anchor-position]: Question: Why is anchor-size() only valid in a sizing property? (#9827)

coderfin has just created a new issue for https://github.com/w3c/csswg-drafts:

== [css-anchor-position]: Question: Why is anchor-size() only valid in a sizing property? ==
Can you help me understand why the [anchor-size() function](https://www.w3.org/TR/css-anchor-position-1/#anchor-size-fn) is limited to being used in a [sizing property](https://www.w3.org/TR/css-sizing-3/#sizing-property)?  It would be useful outside of these properties.

https://www.w3.org/TR/css-anchor-position-1/#anchor-size-valid
https://github.com/web-platform-tests/wpt/blob/master/css/css-anchor-position/anchor-size-parse-invalid.html#L10C4-L10C55

I have a use case where I don't know the `height` or `width` of the _Anchor_ but I would like to apply a `clip-path` to the _Target_ that basically creates a notch in _Target_.

```css
  --anchor-height: anchor-size(--anchor height);
  --anchor-width: anchor-size(--anchor width);
  
  clip-path: polygon(
    0 0,
    0 100%,
    calc(50% - var(--anchor-width) / 2) 100%,
    calc(50% - var(--anchor-width) / 2) var(--anchor-height),
    calc(50% + var(--anchor-width) / 2) var(--anchor-height),
    calc(50% + var(--anchor-width) / 2) 100%,
    100% 100%,
    100% 0
  );
```

![desired-output](https://github.com/w3c/csswg-drafts/assets/1514172/5615d614-575b-4b4b-a17f-88d0a3028451)




Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/9827 using your GitHub account


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

Received on Sunday, 21 January 2024 08:34:16 UTC