So by Google:
1. Hardware pixel - the physical pixel of the display matrix (or, say, a camera). For example, in the screen of the iPhone 5 - 640 physical pixels in width.
2. Device-independent pixel (dip) - the pixels of the display reduced to a single scale to correspond to approximately the same angle of view on all devices (taking into account the distance at which we keep them).
Definition of nothing, let's on the fingers.
Take the monitor (the most common, not high definition):
- A strip of 320 pixels has a length of 8 cm;
- we usually look at the monitor from a distance of, say, 50 cm.
Take iPhone 5:
- always keep closer, even 30 cm;
- strip 320 device-independent pixels should match
the same angle of view .
This means that the 320 dip strip has a length not longer than 8, but 5 cm.
Well, of course, a simple proportion: 8:50 â 5:30. The greater the distance, the larger these âindependentâ pixels must be in order for them to be seen the same way.
For example, iPhone 5 is considered that the screen width (about 5 cm) is just 320 dip.
If this 40-inch information board at the station, which is viewed from a distance of 7 meters, then ... count for yourself how many dip'ov. :)
3. CSS pixel - the unit of measurement of the layout. If it says "
width:
20px
", this is the width of 20 CSS pixels.
By
W3C , 1px = 1/96 inch or about 0.26 mm. But on W3C, everyone doesnât care (and it
âs even
started before W3C), so browsers have always stupidly thought that the CSS pixel is equal to the screen pixel at a scale of 100%. But when the high definition screens came, they realized the whole
... wrong approach. And now it's impossible for the coder to explain how this is half a pixel!
UPD: correct me in the comments . There are already two versions of the definition of the term '1px' in the W3C standard. Therefore, I am glad that I immediately took the terminology of Google as a basis. :)In general, Google offers the formula:
Scale = CSS_pixels / dipScale - page scale
CSS_pixels - the number of CSS pixels in a certain segment (for example, block width)
dip - the number of conditional device-independent pixels on the same segment
Need to explain this further?
