- From: webstrand via GitHub <noreply@w3.org>
- Date: Fri, 16 Jan 2026 21:17:45 +0000
- To: public-css-archive@w3.org
> Doing the "correct" thing of setting a small but relatively static line size and just rounding it to device pixels Why not just make that the _only_ way to do it, like `round(down, 1px, dppx)`, introducing a keyword into the `round()` syntax? It does leave a backdoor for deriving device pixels, but javascript also provides a means. > The env(hairline) value would be a browser-determined length that is just visible, rounded to the nearest integer number of device pixels (with a min of 1dp) at default zoom levels. I was proposing that if a hairline unit is provided, that **all layout** be quantized to that. If layout isn't quantized, then while it solves some of the issues, it doesn't fix issues caused by layout not being integer multiples of the fundamental unit. For instance I mentioned the issues putting hairline borders around/between grid cells. If the hairline is larger than the layout unit, then you get uneven gapping (or borders that are too thick). <img width="200" height="70" alt="Image" src="https://github.com/user-attachments/assets/9408fd46-a574-4ec6-8486-ea2c18210573" /> <https://codepen.io/webstrand/pen/RNRpWzz> The issue here is that the space the grid occupies is not a multiple of the device pixel, so after grid layout, there's an extra device-pixel left over. If this doesn't work for you, you most likely have an integer `devicePixelRatio`, try using `ctrl +` or `ctrl -` to zoom, to get a non-integer device-pixel ratio. Or find a non-integer ratio'd display, maybe a Apple Cinema HD? On higher DPI screens like printer or Retina, the gap is less obviously an issue. --- I don't care too much about whether the layout unit is a device-pixel or a hairline. Just so long as that's what everything gets quantized to prior to the paint phase. -- GitHub Notification of comment by webstrand Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/3720#issuecomment-3761843870 using your GitHub account -- Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config
Received on Friday, 16 January 2026 21:17:46 UTC