Re: [csswg-drafts] [css-values] Ability to address actual physical size (#614)

>  It does not have to work there.

It may not have to work there for you, but if you're going to add a universal concept to CSS then it has to work _everywhere_, otherwise you've made the situation worse: a "physical pixel unit" that claims to be correct, but isn't on some media. Measuring a pipette against a scale claiming a false sense of accuracy is a good illustration of why this matters.

For anyone that considers this "defeatist", please detail a solution for when:
* you've mirrored your screen onto two different size monitors
* you're using  a projector
* you've used the buttons on your LCD monitor to stretch the image to fit (adjustments which are not relayed to the OS)

No solution exists in these cases.

That said, there is a solution for a limited number of cases - specifically, tablets or phones where the hardware is fixed and the screen is not being mirrored. I could see a case for `env(device-pixel-resolution)` here, which resolves to 0 if unknown or indeterminate, but (for example) "326dpi" on an iPhone 11. This could be used in both media queries and `calc()` expressions - for example something like `width: calc(1px * (1dppx / env(device-pixel-resolution)))` would give you a hairline of 1 device pixel. If the resolution was indeterminate it would give you an infinite width, which would - I imagine - encourage authors to wrap their declarations in a suitable media query!

That's not a general "physical pixel unit", but it covers a lot of the same cases while shifting the responsibility of ensuring it's valid to the author - where it needs to be.

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

Received on Tuesday, 7 April 2020 09:06:45 UTC