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

> The proposal was to add `env(hairline)`, not `env(device-pixel-ratio)`. Most of the complexity in your code comes from that.
> 
> But if you want to replicate the "snap a length as a border-width" exactly, then [you can't do it with just `env(hairline)`](https://github.com/w3c/csswg-drafts/issues/3720#issuecomment-2898984858).
> 
> So I'm not sure I get your point. Is it that `env(hairline)` doesn't suit your needs and you would like `border-round()` too?

Uh… there are way too many replies above. I only skimmed a few, so I’m not really sure what everyone’s asking for.

I'm talking about a function `border-width()` (or similar), to, say, make an outline perfectly overlap the border in any device and any DPR:

```css
--width: 1px;
border: var(--width) solid red;
outline: var(--width) dashed lime;
outline-offset: calc(border-width(var(--width)) * -1);
```

If `env(hairline)` works similar, e.g.:

```css
--width: 1;
border: calc(1px * var(--width)) solid red;
outline: calc(1px * var(--width)) dashed lime;
outline-offset: calc(env(hairline) * var(--width) * -1);
```

So, uh… isn’t that basically the same thing? Just a different way of doing it.

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


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

Received on Monday, 6 October 2025 14:09:53 UTC