Skip to content

Instantly share code, notes, and snippets.

@qwertypants
Last active October 3, 2015 07:07
Show Gist options
  • Save qwertypants/2413870 to your computer and use it in GitHub Desktop.
Save qwertypants/2413870 to your computer and use it in GitHub Desktop.
CSS Media Queries template
/* source: all over the interwebz */
/*------------------------ Smartphones ------------------------ */
/* Portrait & Landscape */
@media only screen
and (min-width : 320px)
and (max-width : 480px) {
/* styles */
}
/* Landscape */
@media screen
and (max-width: 640px)
and (orientation: landscape){
/* styles */
}
/* Portrait */
@media screen
and (max-width: 480px)
and (orientation: portrait){
/* styles */
}
/*------------------------ Retina (high resolution) ------------------------ */
@media only screen and (-webkit-min-device-pixel-ratio : 2),
only screen and (min-device-pixel-ratio : 2) {
/* styles */
}
/*------------------------ iPad: catch all + iPad mini -------- */
/* Portrait & Landscape */
@media only screen
and (min-device-width : 768px)
and (max-device-width : 1024px) {
/* styles */
}
/* Landscape */
@media only screen
and (min-width : 768px)
and (max-width : 1024px)
and (orientation : landscape) {
/* styles */
}
/* Portrait */
@media only screen
and (min-width : 768px)
and (max-width : 1024px)
and (orientation : portrait) {
/* styles */
}
/*------------------------ iPad: 1 & 2 (low res) -------------- */
/* Portrait & Landscape */
@media only screen
and (min-device-width : 768px)
and (max-device-width : 1024px)
and (-webkit-min-device-pixel-ratio: 1) {
/* styles */
}
/* Landscape */
@media only screen
and (min-width : 768px)
and (max-width : 1024px)
and (orientation : landscape)
and (-webkit-min-device-pixel-ratio: 1) {
/* styles */
}
/* Portrait */
@media only screen
and (min-width : 768px)
and (max-width : 1024px)
and (orientation : portrait)
and (-webkit-min-device-pixel-ratio: 1) {
/* styles */
}
/*------------------------ iPad: retina ----------------------- */
/* Portrait & Landscape */
@media only screen
and (min-device-width : 768px)
and (max-device-width : 1024px)
and (-webkit-min-device-pixel-ratio: 2) {
/* styles */
}
/* Portrait */
@media only screen
and (min-device-width : 768px)
and (max-device-width : 1024px)
and (orientation : portrait)
and (-webkit-min-device-pixel-ratio: 2) {
/* styles */
}
/* Landscape */
@media only screen
and (min-device-width : 768px)
and (max-device-width : 1024px)
and (orientation : landscape)
and (-webkit-min-device-pixel-ratio: 2) {
/* styles */
}
/*------------------------ Desktops and laptops ---------------- */
@media only screen
and (min-width : 1224px) {
/* Styles */
}
/* Large screens ----------- */
@media only screen
and (min-width : 1824px) {
/* Styles */
}
/* iPhone 4 ----------- */
@media only screen and (-webkit-min-device-pixel-ratio : 1.5),
only screen and (min-device-pixel-ratio : 1.5) {
/* Styles */
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment