Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is dots-per-CSS-inch and dots-per-physical-inch

I've received this message from Chrome Developer Tools console tab when access jsfiddle.net:

Consider using 'dppx' units instead of 'dpi', as in CSS 'dpi' means dots-per-CSS-inch, not dots-per-physical-inch, so does not correspond to the actual 'dpi' of a screen. In media query expression: only screen and (-webkit-min-device-pixel-ratio: 2), not all, not all, only screen and (min-resolution: 192dpi), only screen and (min-resolution: 2dppx)

It's in blue color so I'm assuming that's not a warning or error. So why did I encounter this message? How can I get rid of it or it's just a problem with jsfiddle itself?

like image 812
Felix Avatar asked Feb 23 '14 17:02

Felix


People also ask

What does dots per inch means?

DPI refers to the number of printed dots contained within one inch of an image printed by a printer. PPI refers to the number of pixels contained within one inch of an image displayed on a computer monitor.

What is dots per inch in pixels?

In printing, DPI (dots per inch) refers to the output resolution of a printer or imagesetter, and PPI (pixels per inch) refers to the input resolution of a photograph or image. DPI refers to the physical dot density of an image when it is reproduced as a real physical entity, for example printed onto paper.

Is DPI dots per square inch?

DPI stands for Dots Per Inch. It is a common term that is related to resolution, print quality and image quality. In simple terms, for every inch square of print, there are a set amount of dots that will be printed. The more dots, the better the print quality (there are some exceptions).

Are pixels and dots per inch the same?

What is the difference between PPI and DPI? PPI describes the resolution in pixels of a digital image whereas DPI describes the amount of ink dots on a printed image. Though PPI largely refers to screen display, it also affects the print size of your design and thus the quality of the output.


1 Answers

This is related, but perhaps not limited, to Apples Retina displays. These displays have a higher pixel density than previously used screens but the browser still acts as if it has the same number of pixels.

E.g. the iPhone 3GS had a display with 320 x 480 pixels but the iPhone 4 was released with 640 x 960 pixels. However, instead of showing website at that resolution the browser pretended to have a resolution 320 x 480 pixels.

This leads on to the invention of CSS-pixels. If you specify that something is width:100px in CSS it will be 100 physicals pixels on a normal display but 200 physical pixels on a retina display. A iPhone 3GS and iPhone 4 both have the same dpi (as it is based on pretend CSS-pixels) but very different dppx (as that is based on the real physical pixels).

You can use dppx to detect when a client has a high pixel density screen and serve it a different styling even if the client's browser pretends like it doesn't have that high pixel density.

 .comp {      background-image: url(image.png);  }   @media only screen and (min-resolution: 2dppx) {      .comp {          background-image: url([email protected]);      }  } 

More info here on CSS-pixels: https://developer.mozilla.org/en-US/docs/Web/CSS/resolution

like image 190
Mathias Avatar answered Sep 21 '22 03:09

Mathias