4 ms·
This is just another reason why all browsers (not just mobile) should be reporting their screen size. As in, the actual height/width. Not pixels. Pixels lie
by riskable 12y ago
This is just another reason why all browsers (not just mobile) should be reporting their screen size. As in, the actual height/width. Not pixels. Pixels lie and so do browsers, actually.
If I knew that the user's browser was 3 inches wide I could choose a point-based font size that's appropriate. It would also be trivially easy to scale font and image sizes up or down based on that knowledge. Especially if I'm using SVG.
72pt is precisely 1 inch tall (width is variable). However, if I set a font to 72pt we'll see that almost all browsers get it wrong. They are hard-coded to assume that the user's display is 96dpi or even worse (in the case of Apple devices) it simply pretends that the device is some fixed pixel width when it isn't (i.e. retina displays).
Did you know that the CSS spec has 'in' and 'mm' as size options? Yet when you set the font-size to '1in' you will almost never get a font that is one inch tall because the browser is hard-coded to assume that the user's display is 96dpi. It drives me crazy and it will only get worse over time as we get a larger variety of devices.
We need to stop the madness (that was introduced by Apple with the pretend-the-screen-has-this-many-pixels nonsense) and switch to accurate screen size/dpi reporting. Anything else is doomed to crap like what's mentioned in this article.
- repsilat 12y ago> As in, the actual height/width. Not pixels. What does the browser in an Oculus Rift report? What about the projector on my wall? Perhaps we're more interested in angular sizes, and then possibly pixel densities (again in terms of angular size) in case we need to worry about font legibility etc.
- masklinn 12y ago> Perhaps we're more interested in angular sizes Which is how the reference pixel is defined: > The reference pixel is the visual angle of one pixel on a device with a pixel density of 96dpi and a distance from the reader of an arm's length. For a nominal arm's length of 28 inches, the visual angle is therefore about 0.0213 degrees. For reading at arm's length, 1px thus corresponds to about 0.26 mm (1/96 inch).
- humanrebar 12y ago> As in, the actual height/width. You would also need distance from the user's eyeballs. This is especially important for screens that can be significantly closer or farther from the user depending on the use case. See Google Cardboard. See also larger monitors that could be used as lean-back television displays in dorm rooms.
- masklinn 12y ago> This is just another reason why all browsers (not just mobile) should be reporting their screen size. As in, the actual height/width. That's completely useless, 1cm on a mobile device and 1cm on a desktop are not the same for a user, to say nothing of 1cm on a TV screen, an Oculus Rift (where would you even measure size there?) or a projector (which would require a rangefinder for precise estimation and will probably vary slightly over the whole surface, won't that be fun?) > Not pixels. Pixels lie and so do browsers, actually. And you'd expect them to lie less for "physical dimensions"… why? > Did you know that the CSS spec has 'in' and 'mm' as size options? Yet when you set the font-size to '1in' you will almost never get a font that is one inch tall because the browser is hard-coded to assume that the user's display is 96dpi. It drives me crazy and it will only get worse over time as we get a larger variety of devices. Before suggested that others read the CSS spec, you may want to do so yourself: http://www.w3.org/TR/css3-values/#absolute-lengths http://www.w3.org/TR/css3-values/#absolute-lengths > For lower-resolution devices, and devices with unusual viewing distances, it is recommended instead that the anchor unit be the pixel unit. For such devices it is recommended that the pixel unit refer to the whole number of device pixels that best approximates the reference pixel. > The reference pixel is the visual angle of one pixel on a device with a pixel density of 96dpi and a distance from the reader of an arm's length. For a nominal arm's length of 28 inches, the visual angle is therefore about 0.0213 degrees. For reading at arm's length, 1px thus corresponds to about 0.26 mm (1/96 inch). > We need to stop the madness (that was introduced by Apple with the pretend-the-screen-has-this-many-pixels nonsense) That's not going to happen. Every time some schmuck advocates "practicality > purity" somebody down the road will have to support their "practical choice" and you end up with virtual pixels because all content is completely broken if you use actual physical pixels. > switch to accurate screen size/dpi reporting. http://www.quirksmode.org/blog/archives/2012/06/devicepixelrati.html http://www.quirksmode.org/blog/archives/2012/06/devicepixelr... http://www.quirksmode.org/blog/archives/2012/07/more_about_devi.html http://www.quirksmode.org/blog/archives/2012/07/more_about_d...
- drivingmenuts 12y ago> 1cm on a mobile device and 1cm on a desktop You lost me. How is 1cm on a mobile device not the same as 1 cm on a desktop. Yes, they have different pixels resolutions within that centimeter, but the length of a centimeter doesn't change. Well, unless the engineers are fudging the standard so marketing isn't seen to be lying.