Re: [csswg-drafts] [css-values-4][cssom] Proposal to allow retrieval of sub-pixel border values (#10729)

I don't understand why you are trying to find an element by checking the border width. Why not just add an ID or class?

> Even though sub-pixels can't be rendered

Not necessarily, since 1px may have multiple device pixels.

Also, if you have 2 elements with `width: 50.5px` with 1dppx, they will typically add up to 101px, since internally all major browsers can store that amount (Gecko has a precision of 1px/60, Blink 1px/64, old Edge was 1px/100 I think).

This is not what happens for borders, because borders are snapped. Borders behave in a different way, browsers store the snapped amount, not the original one. So trying to be consistent doesn't work.

```html
<div style="border: solid; border-width: 50px 100.5px; width: 0"></div>
<div style="background: magenta; width: 100.5px; height: 100px; float: left"></div>
<div style="background: magenta; width: 100.5px; height: 100px; float: left"></div>
```

![](https://github.com/user-attachments/assets/d7b1f0aa-7ca0-4ac2-8456-0559348a61da)



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


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

Received on Thursday, 15 August 2024 12:02:28 UTC