Forum Moderators: not2easy
min-width to 512px) and float the panels left. I wish it were something like:
@media screen and -webkit-device-pixel-ratio <2
@media screen and (max-width: 1000px)
{
---adjustments---
} @media screen
and (max-width: 1000px),
and (-webkit-min-device-pixel-ratio : 1.5),
and (min-device-pixel-ratio : 1.5),
and (-webkit-min-device-pixel-ratio : 1),
and (min-device-pixel-ratio : 1)
{
---adjustments---
} and (-webkit-min-device-pixel-ratio : 1),
and (min-device-pixel-ratio : 1)
Comma-separated lists behave like the logical operator or when used in media queries
http://www.quirksmode.org/m/tests/widthtest.html and it shows me that when I re-size my window, other @media tests are triggered correctly against the new window size (not screen size which always remains the same in the quirksmore test).
It works really well with one exception - a friend has an iPad which is 1024px wide but it's a retina display with a 2x pixel density (thus acts like a 2048px width) - but my site is switching to small-screen mode because of the @media command being based on screen width.
[edited by: DrDoc at 9:37 pm (utc) on Aug 20, 2013]
[edit reason] Linked link [/edit]
and (-webkit-min-device-pixel-ratio : 1.5),
<snip>
and (-webkit-min-device-pixel-ratio : 1),
@media only screen and (max-width: 1000px) @media only screen and (max-width: 1000px) and (-webkit-max-device-pixel-ratio: 1.9) @media only screen and (max-width: 1000px) and (-webkit-max-device-pixel-ratio: 1.9), only screen and (max-width: 1000px) and (max-resolution: 1.9dppx)
It doesn't work on IE8 but may well work on later versions (I prefer to test on 8 as it is still prevalent).
There is no device with a pixel ratio of 1.9. There's 1, 1.5 and 2. You can find a 1.3 and there are a few 3's out there.
@media
only screen and (max-width: 1000px) and (-webkit-max-device-pixel-ratio: 1.9),
only screen and (max-width: 1000px) and (max-resolution: 1.9dppx),
only screen and (max-width: 1000px) and (max-resolution: 137dpi)
{
--- mobile adjustments ---
} @media handheld
{ body {background-color: #666;}} /* dark grey */
@media screen
{ body {background-color: #CCC;} } /* lt grey */
@media screen and (min-device-pixel-ratio: .9), screen and (-webkit-min-device-pixel-ratio: .9), screen and (min--moz-device-pixel-ratio: .9), screen and (-o-min-device-pixel-ratio: 9/10)
{ body {background-color: #696;} /* green */ }
@media screen and (min-device-pixel-ratio: 1), screen and (-webkit-min-device-pixel-ratio: 1), screen and (min--moz-device-pixel-ratio: 1), screen and (-o-min-device-pixel-ratio: 1/1)
{ body {background-color: #99F;} /* blue */ }
@media screen and (min-device-pixel-ratio: 1.5), screen and (-webkit-min-device-pixel-ratio: 1.5), screen and (min--moz-device-pixel-ratio: 1.5), screen and (-o-min-device-pixel-ratio: 3/2)
{ body {background-color: #F66;} /* red */ }
@media screen and (min-device-pixel-ratio: 2), screen and (-webkit-min-device-pixel-ratio: 2), screen and (min--moz-device-pixel-ratio: 2), screen and (-o-min-device-pixel-ratio: 2/1)
{ body {background-color: #F9C;} /* lavender */ }
@media screen and (min-device-pixel-ratio: 3), screen and (-webkit-min-device-pixel-ratio: 3), screen and (min--moz-device-pixel-ratio: 3), screen and (-o-min-device-pixel-ratio: 3/1)
{ body {background-color: #FFC;} /* yellow */ }
@media only screen and (-webkit-min-device-pixel-ratio: 2),
only screen and (min-resolution: 192dpi) {
/* Retina-specific stuff here */
header {
background: white url('/images/logo@2x.png') no-repeat;
background-size: 200px 200px;
}
}
<meta name="viewport" content="width=device-width" />
<meta name="viewport" content="width=device-width" />
(min-resolution: 192dpi)
only screen and (min-resolution: 192dppx). In theory, this should talk to Mozilla and Opera - bearing in mind some folk may have Mozilla or Opera driven HD phones.