Skip to content

Instantly share code, notes, and snippets.

@corpsefilth
Created September 18, 2015 21:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save corpsefilth/e98f97fe459f1ddb6f97 to your computer and use it in GitHub Desktop.
Save corpsefilth/e98f97fe459f1ddb6f97 to your computer and use it in GitHub Desktop.
Extended CSS Media Queries Reference
/* --------------------------------------------------------- */
/* BASIC CSS ----------------------------------------------- */
/* --------------------------------------------------------- */
/* YOUR STYLES */
/* --------------------------------------------------------- */
/* MEDIA QUERIES ------------------------------------------- */
/* --------------------------------------------------------- */
/* --------------------------------------------------------- */
/* INFORMATION --- Version 1.1 --- 2012-VII-05 ------------- */
/* --------------------------------------------------------- */
/* ###
1.) Use e.g. "Respond.js" by Scott Jehl to enable responsive web designs in browsers that don't support CSS3 Media Queries (e.g. Internet Explorer 6, 7, 8) --> https://github.com/scottjehl/Respond/
2.) In this case, I use stages for all sizes. Between 1001 pixel and 1249 pixel the browser uses your basic-CSS. You can always delete some stages. After check the stages and adjust some min/max widths. (e.g. If you want to use only one stage for smartphones up to 320 width and one stage for smartphones and devices up to 960 pixel, delete the stages between and set the two new stages for a larger range.)
3.) If you think "Oh, the iPhone 4 has a 640x960 pixel display, so my stage needs only to fit on this in portrait and landscape orientation", it's a trap. The iPhone 4 has this resolution, but it uses only 320x480 pixel device-width. Or the Samsung Galaxy S2. It has a 480x800 pixel display --> 320x450 pixel and 320x508 pixel device-width in portrait orientation / 533x237 pixel in width and device-width in landscape orientation. // Quick Tip: "Tablet Computer - 150+ Display Measurements" --> http://www.designfalcon.com/#tablets
4.) Think about PNG-Fix for old IE (e.g. "jquery.pngFix.js" by Andreas Eberhard --> http://jquery.andreaseberhard.de/pngFix/), IE Background-Fix (e.g. "backgroundSize.js" by Louis Remi --> https://github.com/louisremi/jquery.backgroundSize.js) and last but noch least a emulator for CSS3 pseudo classes and attribut selectors for old IE (e.g. "Selectivizr.js" by Keith Clark --> http://selectivizr.com/).
5.) More information about "max-width" and "max-device-width": "max-width" refers to the actual viewport and can target specific sizes and orientations; "max-device-width" refers to the device viewport size, regardless of browser-scale, orientation or resizing. Shorthand: "max-width" (and "max-height") = target display area // "max-device-width" (and "max-device-height") = device entire rendering area. Same for "min" values.
6.) Thanks for your time! (: Andi "Licious" Wieser (Oh, you have some time left or further questions? --> andilicious.com // twitter.com/andiliciouscom // fb.com/andiliciouscom // pinterest.com/licious).
### */
/* --------------------------------------------------------- */
/* APPLE MACBOOK PRO RETINA ETC. --------------------------- */
/* --------------------------------------------------------- */
/* Retina Displays/Screens (2880x1800) --------------------- */
@media
only screen and (min--moz-device-pixel-ratio: 2),
only screen and (-o-min-device-pixel-ratio: 2/1),
only screen and (-webkit-min-device-pixel-ratio: 2),
only screen and (min-device-pixel-ratio: 2),
only screen and (min-resolution: 2dppx) {
}
/* --------------------------------------------------------- */
/* SMARTPHONES, TABLETS & TINY DESKTOPS -------------------- */
/* --------------------------------------------------------- */
/* Old Smartphones (portrait and landscape) ---------------- */
@media
only screen and (min-device-width: 240px) and (max-device-width: 320px) {
/* YOUR STYLES */
}
/* Old Smartphones (e.g. portrait) ------------------------- */
@media
only screen and (max-width: 319px) {
/* YOUR STYLES */
}
/* Smartphones (portrait and landscape) -------------------- */
@media
only screen and (min-device-width: 320px) and (max-device-width: 640px) {
/* YOUR STYLES */
}
/* Smartphones (portrait) & Old SP (landscape) ------------- */
@media
only screen and (min-width: 320px) and (max-width: 479px) {
/* YOUR STYLES */
}
/* Smartphones (landscape) & Old Tablets (Portrait) -------- */
@media
only screen and (min-width: 480px) and (max-width: 639px) {
/* YOUR STYLES */
}
/* Smartphones & Tablets (portrait & landscape) ------------ */
@media
only screen and (min-device-width: 640px) and (max-device-width: 960px) {
/* YOUR STYLES */
}
/* Smartphones & Tablets (portrait) & Tiny Desktops -------- */
@media
only screen and (min-width: 640px) and (max-width: 799px) {
/* YOUR STYLES */
}
/* Smartphones & Tablets (landscape) & Splitted Desktops --- */
@media
only screen and (min-width: 800px) and (max-width: 1000px) {
/* YOUR STYLES */
}
/* --------------------------------------------------------- */
/* DEVICES BY RATIO ---------------------------------------- */
/* --------------------------------------------------------- */
/* LowRes (e.g. 240x320 / 320x480) ------------------------- */
@media
only screen and (min--moz-device-pixel-ratio: 0.75),
only screen and (-o-min-device-pixel-ratio: 3/4),
only screen and (-webkit-min-device-pixel-ratio: 0.75),
only screen and (min-device-pixel-ratio: 0.75),
only screen and (min-resolution: 0.75dppx) {
/* YOUR STYLES */
}
/* HighRes ------------------------------------------------- */
@media
only screen and (min--moz-device-pixel-ratio: 1.5),
only screen and (-o-min-device-pixel-ratio: 3/2),
only screen and (-webkit-min-device-pixel-ratio: 1.5),
only screen and (min-device-pixel-ratio: 1.5),
only screen and (min-resolution: 1.5dppx) {
/* YOUR STYLES */
/* e.g. HighRes Logo (use _2x as extension for double-sized images) */
/* .logo {background-image: url(logo_2x.png); background-size: 50%;} */
}
/* RetinaRes Smartphones (e.g. iPhone 4 / portrait) -------- */
@media
only screen and (min--moz-device-pixel-ratio: 1.5) and (orientation: portrait),
only screen and (-o-min-device-pixel-ratio: 3/2) and (orientation: portrait),
only screen and (-webkit-min-device-pixel-ratio: 1.5) and (orientation: portrait),
only screen and (min-device-pixel-ratio: 1.5) and (orientation: portrait),
only screen and (min-resolution: 1.5dppx) and (orientation: portrait) {
/* YOUR STYLES */
}
/* RetinaRes Smartphones (e.g. iPhone 4 / landscape) ------- */
@media
only screen and (min--moz-device-pixel-ratio: 1.5) and (orientation: landscape),
only screen and (-o-min-device-pixel-ratio: 3/2) and (orientation: landscape),
only screen and (-webkit-min-device-pixel-ratio: 1.5) and (orientation: landscape),
only screen and (min-device-pixel-ratio: 1.5) and (orientation: landscape),
only screen and (min-resolution: 1.5dppx) and (orientation: landscape) {
/* YOUR STYLES */
}
/* --------------------------------------------------------- */
/* IPADS --------------------------------------------------- */
/* --------------------------------------------------------- */
/* iPads (portrait and landscape) -------------------------- */
@media
only screen and (min-device-width: 768px) and (max-device-width: 1024px) {
/* YOUR STYLES */
}
/* iPads (portrait) ---------------------------------------- */
@media
only screen and (min-device-width: 768px) and (max-device-width: 1024px) and (orientation: portrait) {
/* YOUR STYLES */
}
/* iPads (landscape) --------------------------------------- */
@media
only screen and (min-device-width: 768px) and (max-device-width: 1024px) and (orientation: landscape) {
/* YOUR STYLES */
}
/* iPad Retina (iPad 3; portrait and landscape) ------------ */
@media
only screen and (min-device-width: 1536px) and (max-device-width: 2048px) and (min--moz-device-pixel-ratio: 2),
only screen and (min-device-width: 1536px) and (max-device-width: 2048px) and (-o-min-device-pixel-ratio: 2/1),
only screen and (min-device-width: 1536px) and (max-device-width: 2048px) and (-webkit-min-device-pixel-ratio: 2),
only screen and (min-device-width: 1536px) and (max-device-width: 2048px) and (min-device-pixel-ratio: 2),
only screen and (min-device-width: 1536px) and (max-device-width: 2048px) and (min-resolution: 2dppx) {
/* YOUR STYLES */
}
/* --------------------------------------------------------- */
/* COMPUTERS / OTHER DEVICES ------------------------------- */
/* --------------------------------------------------------- */
/* Displays/Screens (e.g. MacBook @ 1280x800) -------------- */
@media
only screen and (min-width: 1250px) and (max-width: 1409px) {
/* YOUR STYLES */
}
/* Displays/Screens (e.g. 19" WS @ 1440x900) --------------- */
@media
only screen and (min-width: 1410px) and (max-width: 1649px) {
/* YOUR STYLES */
}
/* Displays/Screens (e.g. 22" WS @ 1680x1050) -------------- */
@media
only screen and (min-width: 1650px) and (max-width: 1889px) {
/* YOUR STYLES */
}
/* Displays/Screens (e.g. 24" WS @ 1920x1080) -------------- */
@media
only screen and (min-width: 1890px) and (max-width: 2529px) {
/* YOUR STYLES */
}
/* Really Large Displays/Screens (e.g. 2560x1440) ---------- */
@media
only screen and (min-width: 2530px) {
/* YOUR STYLES */
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment