Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
CSS Media Query Cheat Sheet (with Foundation)
/*------------------------------------------
Responsive Grid Media Queries - 1280, 1024, 768, 480
1280-1024 - desktop (default grid)
1024-768 - tablet landscape
768-480 - tablet
480-less - phone landscape & smaller
--------------------------------------------*/
@media all and (min-width: 1024px) and (max-width: 1280px) { }
@media all and (min-width: 768px) and (max-width: 1024px) { }
@media all and (min-width: 480px) and (max-width: 768px) { }
@media all and (max-width: 480px) { }
/*------------------------------------------
Foundation Media Queries
http://foundation.zurb.com/docs/media-queries.html
--------------------------------------------*/
/* Small screens - MOBILE */
@media only screen { } /* Define mobile styles - Mobile First */
@media only screen and (max-width: 40em) { } /* max-width 640px, mobile-only styles, use when QAing mobile issues */
/* Medium screens - TABLET */
@media only screen and (min-width: 40.063em) { } /* min-width 641px, medium screens */
@media only screen and (min-width: 40.063em) and (max-width: 64em) { } /* min-width 641px and max-width 1024px, use when QAing tablet-only issues */
/* Large screens - DESKTOP */
@media only screen and (min-width: 64.063em) { } /* min-width 1025px, large screens */
@media only screen and (min-width: 64.063em) and (max-width: 90em) { } /* min-width 1024px and max-width 1440px, use when QAing large screen-only issues */
/* XLarge screens */
@media only screen and (min-width: 90.063em) { } /* min-width 1441px, xlarge screens */
@media only screen and (min-width: 90.063em) and (max-width: 120em) { } /* min-width 1441px and max-width 1920px, use when QAing xlarge screen-only issues */
/* XXLarge screens */
@media only screen and (min-width: 120.063em) { } /* min-width 1921px, xlarge screens */
/*------------------------------------------*/
/* Portrait */
@media screen and (orientation:portrait) { /* Portrait styles here */ }
/* Landscape */
@media screen and (orientation:landscape) { /* Landscape styles here */ }
/* CSS for iPhone, iPad, and Retina Displays */
/* Non-Retina */
@media screen and (-webkit-max-device-pixel-ratio: 1) {
}
/* Retina */
@media only screen and (-webkit-min-device-pixel-ratio: 1.5),
only screen and (-o-min-device-pixel-ratio: 3/2),
only screen and (min--moz-device-pixel-ratio: 1.5),
only screen and (min-device-pixel-ratio: 1.5) {
}
/* iPhone Portrait */
@media screen and (max-device-width: 480px) and (orientation:portrait) {
}
/* iPhone Landscape */
@media screen and (max-device-width: 480px) and (orientation:landscape) {
}
/* iPad Portrait */
@media screen and (min-device-width: 481px) and (orientation:portrait) {
}
/* iPad Landscape */
@media screen and (min-device-width: 481px) and (orientation:landscape) {
}
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" />
/*------------------------------------------
Live demo samples
- http://andrelion.github.io/mediaquery/livedemo.html
--------------------------------------------*/
@radovansurlak
Copy link

radovansurlak commented Apr 24, 2020

Thank you :)

@tichif
Copy link

tichif commented May 8, 2020

thanks

@thalhatou
Copy link

thalhatou commented May 16, 2020

Thanks

@Min11Benja
Copy link

Min11Benja commented May 22, 2020

Thank you very much!

@forc3
Copy link

forc3 commented May 25, 2020

Thanks

@pharouqy
Copy link

pharouqy commented May 26, 2020

thanks a lot ...

@harshmaisheri
Copy link

harshmaisheri commented Jun 5, 2020

Thanks a ton..

@luvagu
Copy link

luvagu commented Jun 16, 2020

very useful, thx!

@dp9289
Copy link

dp9289 commented Jul 21, 2020

Thank you buddy, Really Helpful.

@changexd
Copy link

changexd commented Sep 8, 2020

Thanks bro!

@BobRusch
Copy link

BobRusch commented Oct 2, 2020

THX!!! This will come in handy!!!

@DiegoArista
Copy link

DiegoArista commented Oct 4, 2020

That´s cool!

@jasonkim-jk
Copy link

jasonkim-jk commented Oct 24, 2020

Thanks a lot

@ckaethler
Copy link

ckaethler commented Nov 4, 2020

Thank you!

@jlbokass
Copy link

jlbokass commented Jan 8, 2021

Thank you !

@taylorhahn27
Copy link

taylorhahn27 commented Jan 17, 2021

thanks!!!

@Zorba11
Copy link

Zorba11 commented Feb 6, 2021

Thank you !!

@maxfontani
Copy link

maxfontani commented Feb 26, 2021

Thx!

@xoshly
Copy link

xoshly commented Apr 2, 2021

Thank you so much!!

@jio-com
Copy link

jio-com commented Aug 28, 2021

The link: http://foundation.zurb.com/docs/media-queries.html is not working what It had?

@lagerdoo
Copy link

lagerdoo commented Oct 1, 2021

Thank you 👌🏽🙏🏽

@Gitalus
Copy link

Gitalus commented Oct 3, 2021

thanks you!

@Kaung2021
Copy link

Kaung2021 commented Oct 11, 2021

Thanks you

@MoazzamAzeemi
Copy link

MoazzamAzeemi commented Oct 30, 2021

Good Work... Thanks

@harriscs5
Copy link

harriscs5 commented Jan 5, 2022

thank youuu

@Hyderite
Copy link

Hyderite commented Jan 28, 2022

thanks man, really helpful

@juanitatime
Copy link

juanitatime commented Feb 19, 2022

Thanks for this really helpful!

@Zionknight-crypto
Copy link

Zionknight-crypto commented Mar 20, 2022

Thanks for this!

@noureddineNh9
Copy link

noureddineNh9 commented May 12, 2022

aze

@tashin12
Copy link

tashin12 commented Jun 15, 2022

Thanks man

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment