PROJET AUTOBLOG


Shaarli - Les discussions de Shaarli

Archivé

Site original : Shaarli - Les discussions de Shaarli du 23/07/2013

⇐ retour index

css - what exactly is device pixel ratio? - Stack Overflow - jcfrog's shaarli

lundi 21 juillet 2014 à 16:32
JCFrog, le 21/07/2014 à 15:25
In the world of web development, the device pixel ratio (also called CSS Pixel Ratio) is what determines how a device's screen resolution is interpreted by the CSS.

CSS interprets a device's resolution by the formula: device_resolution/css_pixel_ratio. For example:

Samsung Galaxy S III

   Actual resolution: 720 x 1280
   CSS Pixel Ratio: 2
   Interpreted resolution: (720/2) x (1280/2) = 360 x 640

When viewing a web page, the CSS will think the device has a 360x640 resolution screen and Media Queries will respond as if the screen is 360x640. But the rendered elements on the screen will be twice as sharp as an actual 360x640 screen.
(Permalink)

Timo, le 21/07/2014 à 16:32
+1

J’avais moi-même une page là : http://lehollandaisvolant.net/tuto/responsive-css/ (avec les explications en français, l’origine, les solutions et les limites — par exemple en JavaScript — du pixel-ratio).
— (permalink)
(Permalink)