Skip to content

Instantly share code, notes, and snippets.

@justo
Last active December 19, 2015 21:59
Show Gist options
  • Save justo/6024581 to your computer and use it in GitHub Desktop.
Save justo/6024581 to your computer and use it in GitHub Desktop.
Simple CSS3 Media Queries
/* Justin's simple CSS3 media queries (not mobile-first) */
/* Desktops */
@media only screen and (min-width : 1024px) {
}
/* Tablets */
@media only screen and (min-width : 641px) and (max-width : 1024px) {
}
/* Smartphones (All) */
@media only screen and (max-width : 640px) {
}
/* Smartphones (Small) */
@media only screen and (max-width : 320px) {
}
/* HiDPI Devices + Print */
@media print, (-o-min-device-pixel-ratio: 5/4), (-webkit-min-device-pixel-ratio: 1.25), (min-device-pixel-ratio : 1.25), (min-resolution: 120dpi) {
}
/* More comprehensive hidpi detection (not sure if its better or not yet) */
@media only screen and (-webkit-min-device-pixel-ratio: 2), only screen and (min--moz-device-pixel-ratio: 2), only screen and (-moz-min-device-pixel-ratio: 2), only screen and (-o-min-device-pixel-ratio: 2/1), only screen and (min-device-pixel-ratio: 2), only screen and (min-resolution: 192dpi), only screen and (min-resolution: 2dppx) {
}
/* Common screen size aspect ratio queries */
@media only screen and (min-aspect-ratio: 5/4) {
}
@media only screen and (min-aspect-ratio: 4/3) {
}
@media only screen and (min-aspect-ratio: 3/2) {
}
@media only screen and (min-aspect-ratio: 16/10) {
}
@media only screen and (min-aspect-ratio: 16/9) {
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment