When using CSS media queries for device pixel density, I have seen both -moz-min-device-pixel-ratio
and min--moz-device-pixel-ratio
.
For example:
@media
only screen and (-moz-min-device-pixel-ratio: 1.5) {
/* styles go here */
}
vs.
@media
only screen and (min--moz-device-pixel-ratio: 1.5) {
/* styles go here*/
}
Which is correct?
Some tutorials/blogs that use the former:
Some tutorials/blogs that use the later, including mozilla.org:
A hardware pixel is an individual dot of light in the display. A software pixel, also called a CSS pixel in the web world, is a unit of measurement. The device manufacturer determines how many hardware pixels equals one software pixel, a concept known as the device pixel ratio.
Dividing the physical ppi by the ideal ppi of 150, gives the device pixel ratio.
The devicePixelRatio of Window interface returns the ratio of the resolution in physical pixels to the resolution in CSS pixels for the current display device. This value could also be interpreted as the ratio of pixel sizes: the size of one CSS pixel to the size of one physical pixel.
Device pixel ratio (DPR) is an easy way to convert between device-independent pixels and device pixels (also called "CSS pixels"), so that high-DPR images are only delivered to devices that can support them.
The second one is correct.
This is from http://www.quirksmode.org/blog/archives/2012/07/vendor_prefixes.html
-webkit-min-device-pixel-ratio: 1.5
min--moz-device-pixel-ratio: 1.5
-o-min-device-pixel-ratio: 3/2
I'm the author of the menacing cloud article referenced above. The device-pixel-ratio listed in my article was incorrect since it was written quite a while ago (iPhone4 launch).
It has been updated to reference the correct Mozilla syntax.
I have no idea why Mozilla chose to go with min--moz-device-pixel-ratio, but that is the official form chosen it seems.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With