- From: Mark Watson <watsonm@netflix.com>
- Date: Thu, 21 Mar 2013 20:53:52 +0000
- To: Florian Rivoal <florian@rivoal.net>
- CC: Kenneth Rohde Christiansen <kenneth.r.christiansen@intel.com>, "www-style@w3.org" <www-style@w3.org>
On Mar 21, 2013, at 1:23 PM, Florian Rivoal wrote: > On Wed, 20 Mar 2013 16:09:02 +0100, Kenneth Rohde Christiansen <kenneth.r.christiansen@intel.com> wrote: > >> WebKit has devicePixelRatio so you can device the device size by using >> that. Something to query that should probably be standardized, but >> media queries are not exactly for querying exact values. > > Something has been standardized, actually: > > http://www.w3.org/TR/css3-mediaqueries/#resolution > > The following: > > @media (min-resolution: 2dppx) { ... } > > is completely equivalent to: > > @media (min-device-pixel-ratio: 2) { ... } > > if the dppx unit is not available, you can get the exact same result (if a bit less author friendly) with > > @media (min-resolution: 192dpi) { ... } > > The dppx / dpcm / dpi units are defined in terms of device pixel per CSS px / CSS cm / CSS inch, so that it would work. > > - Florian > Ok, so if I knew the screen height in CSS pixels was H, and I have media suitable for a screen with a height of 1080 device pixels, then I guess I can calculate X = 1080 / H and then (programmatically) say @media ( min-resolution: Xdppx) And I believe I can get the screen height in CSS pixels from window somewhere. This doesn't seem very natural, though, and can't be done declaratively. It would be much more natural to say: @media ( min-device-height: 1080dpx ) i.e. to introduce a new "device pixels" <length> measurement. …Mark
Received on Thursday, 21 March 2013 20:54:21 UTC