- From: Dan Burzo via GitHub <sysbot+gh@w3.org>
- Date: Fri, 31 Jan 2025 11:47:32 +0000
- To: public-css-archive@w3.org
I now understand that I’m very late to the party, and [the change](https://github.com/w3c/csswg-drafts/commit/0c0e8bc9905441e509cfb4c8772b184114965c39) is in response to:
- https://github.com/w3c/csswg-drafts/issues/8169
In any case, `tan(atan2())` calculation doesn’t work as-is in current browsers. Instead, it requires an intermediary registered `<length>` property:
```css
@property --1em {
syntax: '<length>';
initial-value: 0px;
inherits: false;
}
:root {
font-family: Newsreader;
--opsz-ratio: 0.75;
}
* {
font-variation-settings: 'opsz'
tan(atan2(var(--1em) * var(--opsz-ratio), 1px));
--1em: 1em;
padding-block: var(--1em);
}
```
As seen in the [live demo](https://danburzo.ro/demos/px-to-opsz.html), there is an interop issue:
* Firefox (stable/nightly macOS) and Safari (stable/TP macOS) use the current element’s font-size to compute `1em`.
* In Chrome (stable/canary macOS), `--1em = 16px` if the `font-variation-settings` is present (and reflects on `padding` as well). If the `font-variation-settings` declaration is removed, `--1em` becomes the element’s font-size. [[Chromium#392317688](https://issues.chromium.org/issues/392317688)]
I am unsure what the spec-mandated behavior is here.
--
GitHub Notification of comment by danburzo
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/11629#issuecomment-2627016805 using your GitHub account
--
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config
Received on Friday, 31 January 2025 11:47:33 UTC