public
Last active

  • Download Gist
mq.css
CSS
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
@media only screen and (min-width: 320px) {
 
/* Small screen, non-retina */
 
}
 
@media
only screen and (-webkit-min-device-pixel-ratio: 2) and (min-width: 320px),
only screen and ( min--moz-device-pixel-ratio: 2) and (min-width: 320px),
only screen and ( -o-min-device-pixel-ratio: 2/1) and (min-width: 320px),
only screen and ( min-device-pixel-ratio: 2) and (min-width: 320px),
only screen and ( min-resolution: 192dpi) and (min-width: 320px),
only screen and ( min-resolution: 2dppx) and (min-width: 320px) {
 
/* Small screen, retina, stuff to override above media query */
 
}
 
@media only screen and (min-width: 700px) {
 
/* Medium screen, non-retina */
 
}
 
@media
only screen and (-webkit-min-device-pixel-ratio: 2) and (min-width: 700px),
only screen and ( min--moz-device-pixel-ratio: 2) and (min-width: 700px),
only screen and ( -o-min-device-pixel-ratio: 2/1) and (min-width: 700px),
only screen and ( min-device-pixel-ratio: 2) and (min-width: 700px),
only screen and ( min-resolution: 192dpi) and (min-width: 700px),
only screen and ( min-resolution: 2dppx) and (min-width: 700px) {
 
/* Medium screen, retina, stuff to override above media query */
 
}
 
@media only screen and (min-width: 1300px) {
 
/* Large screen, non-retina */
 
}
 
@media
only screen and (-webkit-min-device-pixel-ratio: 2) and (min-width: 1300px),
only screen and ( min--moz-device-pixel-ratio: 2) and (min-width: 1300px),
only screen and ( -o-min-device-pixel-ratio: 2/1) and (min-width: 1300px),
only screen and ( min-device-pixel-ratio: 2) and (min-width: 1300px),
only screen and ( min-resolution: 192dpi) and (min-width: 1300px),
only screen and ( min-resolution: 2dppx) and (min-width: 1300px) {
 
/* Large screen, retina, stuff to override above media query */
 
}

Hi Chris!

I don't think these Media Queries are that ideal. ;-)
First of all you do not mention that there are a lot of mobile devices out there which have a lower resolution than the Retina display, but a higher one than Desktop screens (e.g. device-pixel-ratio: 1.5)
Secondly assume you are on a high resolution (device-pixel-ratio >= 2) screen with at least a width of 1300px then all of your MQ matches! That means you have to carefully watch out to overwrite each and every property.

In my general understanding it would be best to have

  • a basic layout for browsers that do not understand MQs
  • MQs of which only one matches

BTW: I also do not like the naming particularly well ..., as we do not want to match certain devices like iPhone or iPad, but instead their respective capabilities. For an author it does not matter if it is an iPhone or not. All he needs to know is that it is a touch device with a certain resolution and viewport size.

I hope you get the points even though my English is a bit rusty (and not my mother tongue).

Cheers
Gunther

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.