Last active
March 2, 2024 07:05
-
-
Save hemantajax/5938709 to your computer and use it in GitHub Desktop.
Very useful media queries snippets
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Smartphones (portrait and landscape) ----------- */ | |
@media only screen | |
and (min-device-width : 320px) | |
and (max-device-width : 480px) { | |
/* Styles */ | |
} | |
/* Smartphones (landscape) ----------- */ | |
@media only screen | |
and (min-width : 321px) { | |
/* Styles */ | |
} | |
/* Smartphones (portrait) ----------- */ | |
/* viewport size <= 320px ----------- */ | |
@media only screen | |
and (max-width : 320px) { | |
/* Styles */ | |
} | |
/* iPads (portrait and landscape) ----------- */ | |
@media only screen | |
and (min-device-width : 768px) | |
and (max-device-width : 1024px) { | |
/* Styles */ | |
} | |
/* iPads (landscape) ----------- */ | |
@media only screen | |
and (min-device-width : 768px) | |
and (max-device-width : 1024px) | |
and (orientation : landscape) { | |
/* Styles */ | |
} | |
/* iPads (portrait) ----------- */ | |
@media only screen | |
and (min-device-width : 768px) | |
and (max-device-width : 1024px) | |
and (orientation : portrait) { | |
/* Styles */ | |
} | |
/* Desktops and laptops ----------- */ | |
@media only screen | |
and (min-width : 1224px) { | |
/* Styles */ | |
} | |
/* Large screens ----------- */ | |
@media only screen | |
and (min-width : 1824px) { | |
/* Styles */ | |
} | |
/*************** Specific to device if required **********************/ | |
/* stolen from http://nmsdvid.com/snippets/ **************************/ | |
/* iPhone 4 ----------- */ | |
@media only screen and (-webkit-min-device-pixel-ratio : 1.5), | |
only screen and (min-device-pixel-ratio : 1.5) { | |
/* Styles */ | |
} | |
/* iPhone5 ------------- */ | |
@media screen and (device-aspect-ratio: 40/71) { | |
/* Styles */ | |
} | |
or | |
@media screen and (device-width: 320px) and (device-height: 568px) and (-webkit-device-pixel-ratio: 2){ | |
/* Styles */ | |
} | |
/* Blackberry Torch ---------- */ | |
@media screen and (max-device-width: 480px) { | |
} | |
/* Samsung S3 ---------------- */ | |
@media only screen and (-webkit-device-pixel-ratio: 2) { | |
} | |
/* Google Nexus 7 ------------- */ | |
@media screen and (device-width: 600px) and (device-height: 905px) and (-webkit-min-device-pixel-ratio: 1.331) and (-webkit-max-device-pixel-ratio: 1.332) { | |
} | |
/* iPad Mini ------------------ */ | |
@media screen and (device-width: 768px) and (device-height: 1024px) and (-webkit-device-pixel-ratio: 1) { | |
} | |
/* iPad 3 (Landscape)-------------------- */ | |
@media (max-device-width: 1024px) and (orientation: landscape) { | |
} | |
/* iPad 3 (portrait)-------------------- */ | |
@media (max-device-width: 768px) and (orientation: portrait) { | |
} | |
/* Galaxy Tab 10.1 (Landscape) -------- */ | |
@media (max-device-width: 1280px) and (orientation: landscape) { | |
} | |
/* Galaxy Tab 10.1 (Portrait) -------- */ | |
@media (max-device-width: 800px) and (orientation: portrait) { | |
} | |
/* Retina images ---------------------- */ | |
@media | |
only screen and (-webkit-min-device-pixel-ratio: 2), | |
only screen and ( min--moz-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) { | |
/* Retina replacement CSS here */ | |
} | |
thank you so much
Thanks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
great input, thanks