2 ms·
Viewport units, pixel units - all of these sidestep what the actual unit ought to be relative to: the physical size of the screen (adjusted for how far away it
by hammock 11y ago
Viewport units, pixel units - all of these sidestep what the actual unit ought to be relative to: the physical size of the screen (adjusted for how far away it is from your eyes).
If I'm holding a 6 inch tablet, or a 9 inch tablet, both 2 feet away from my face and with potentially different ppi, there's no reason for the 9 inch tablet to have 50% larger font size.
Declaring size relative to pixels solves this only when PPI is constant.
- Chris_Newton 11y agoActually, CSS does already work almost the way you described. For devices where the anchor unit is px, a CSS length of 1px is not defined in terms of a single physical pixel on a screen but is instead an angular unit. More specifically, in CSS 2.1, a “reference pixel” has an angle that corresponds to one physical pixel on a 96dpi display at a nominal arm’s length distance of 28in. A measurement of 1px is then recommended to refer to the whole number of device pixels that best approximates the reference pixel. In principle, that means whether you’re holding a phone or tablet with a Retina-class display relatively close, looking at a traditional large format desktop screen with fewer pixels-per-inch, or looking at a projected screen from a typical viewing distance in a lecture theatre, sizing in terms of px should still have approximately the same effect. However, you do still have a difference of up to 1/3 of the nominal size to contend with: a browser running on a device where a physical pixel is around 150% the size of a nominal reference pixel has to choose whether to use 1 or 2 display pixels for each px, resulting in output that is either 2/3 or 4/3 of the theoretical ideal size. I’ve been assuming this is part of the reason we see so many blogs currently displaying irritatingly large body text if they’re viewed on a desktop or laptop screen: the designers found that a more traditional font-size was too small for comfortable reading on whatever mobile device they were using at the distance they prefer to hold it, so they increased it. For more on the CSS px definition, you can check the W3C spec: https://www.w3.org/TR/CSS21/syndata.html#length-units https://www.w3.org/TR/CSS21/syndata.html#length-units
- hammock 11y agoAwesome, thanks! Yes, angular unit is what I was fumbling for.