Re: [csswg-drafts] [css-borders] Add a 'hairline' border-width value (#3720)

@SebastianZ why not reuse the existing `round(up, 0.5px, 1dpx)` function? Then you can reuse the existing rounding modes provided by that function. Ultimately, if you expose a `device-pixel-round()` authors will be able to use it to derive a `1dpx` unit _anyway_. You could restrict the unit `1dpx` to be a singleton, so `2dpx` would be invalid (or extensible in the future), forcing authors to resort to `calc(100 * 1dpx)` if they actually want to use the unit. This is probably sufficiently discouraging to prevent casual use of the unit?

In my sites I currently inject a:
```css
@property --dpx {
 syntax: "<length>";
 inherits: true;
 initial-value: 1px;
}
:root { --dpx: 0.8666666666666667px }
```
via javascript so that I can make things look non-fuzzy. My displays have a native non-integer ratio to css pixels, which is why the size is fractional.

Used like `round(var(--thumbnail-width), var(--dpx))` it works very well in solving the problem in chrome/firefox.

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


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

Received on Wednesday, 30 April 2025 14:49:59 UTC