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

> I might want to use padding in order to reserve space for a box-shadow hairline... 

Sure, we could allow hairlines there.

> Or I could imagine wanting an nth multiple of hairlines.

Sure, we could even make hairline just an absolute length unit, like `2hairline`, or it can be a calc() keyword that resolves to a length, like `calc(2 * hairline)`. Either route makes hairlines usable *everywhere*, and avoids any potential grammar issues that could arise from adding a keyword to the `<length>` type.

> Sure, though this behavior is unlikely to be changeable? It's fairly long-standing in some way or another...

Yeah, not saying we should get rid of the behavior, just that we might not want to *rely* on it for the hairlining, for several reasons. (And we might want to clamp it to the actual hairline width, rather than "nearest device pixel", so future screens don't round up to a nearly-invisible width.)

> What should [the size of a hairline on a screen with 100 device pixels per px] be?

Like Florian said, around half or a third of a px, probably. That's a question for designers and a11y folks - whatever the minimal visible width of a "hairline" that's appropriate. My point is that a "hairline border" is a meaningful concept that has *no* connection to device pixels, except insofar as the device pixels on many screens are currently approximately the right width for a hairline.

> But it's not just a matter of knowing the resolution, in order to avoid blurriness authors would also need the ability to align things correctly with the device pixels?

Right, rounding the width to device pixels is important for usability, so just exposing a resolution directly doesn't actually solve the problem, afaict.

> the painted line within that size should probably be rounded / snapped to an integer number of pixels, taking position into account, in order to avoid blurriness

Border snapping already handles that for us, luckily.

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


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

Received on Thursday, 5 September 2024 18:24:25 UTC