Skip to content

Instantly share code, notes, and snippets.

@OkoyaUsman
Created January 16, 2018 14:35
Show Gist options
  • Save OkoyaUsman/8f526e64dc5f817387f13642bca42606 to your computer and use it in GitHub Desktop.
Save OkoyaUsman/8f526e64dc5f817387f13642bca42606 to your computer and use it in GitHub Desktop.
Advanced CSS Media Queries for All The Common Devices
/* ------ Large screens ----------- */
@media only screen and (min-width : 1824px) {
/* Styles go here.. */
}
/* ------ Desktops and laptops ----------- */
@media only screen and (min-width : 1224px) {
/* Styles go here.. */
}
/* ------ Smartphones (portrait and landscape) ----- */
@media only screen and (min-device-width : 320px) and (max-device-width : 480px) {
/* Styles go here.. */
}
/* ------ Smartphones (landscape) ----------- */
@media only screen and (min-width : 321px) {
/* Styles go here.. */
}
/* ------ Smartphones (portrait) ----------- */
@media only screen and (max-width : 320px) {
/* Styles go here.. */
}
/* ------ iPads (portrait and landscape) ----------- */
@media only screen and (min-device-width : 768px) and (max-device-width : 1024px) {
/* Styles go here.. */
}
/* ------ iPads (landscape) ----------- */
@media only screen and (min-device-width : 768px) and (max-device-width : 1024px) and (orientation : landscape) {
/* Styles go here.. */
}
/* ------ iPads (portrait) ----------- */
@media only screen and (min-device-width : 768px) and (max-device-width : 1024px) and (orientation : portrait) {
/* Styles go here.. */
}
/* ------ iPad 3 ------ */
@media only screen and (min-device-width : 768px) and (max-device-width : 1024px) and (orientation : landscape) and (-webkit-min-device-pixel-ratio : 2) {
/* Styles go here.. */
}
@media only screen and (min-device-width : 768px) and (max-device-width : 1024px) and (orientation : portrait) and (-webkit-min-device-pixel-ratio : 2) {
/* Styles go here.. */
}
/* ------ iPhone 5 ----------- */
@media only screen and (min-device-width: 320px) and (max-device-height: 568px) and (orientation : landscape) and (-webkit-device-pixel-ratio: 2){
/* Styles go here.. */
}
@media only screen and (min-device-width: 320px) and (max-device-height: 568px) and (orientation : portrait) and (-webkit-device-pixel-ratio: 2){
/* Styles go here.. */
}
/* ------ iPhone 6 ----------- */
@media only screen and (min-device-width: 375px) and (max-device-height: 667px) and (orientation : landscape) and (-webkit-device-pixel-ratio: 2){
/* Styles go here.. */
}
@media only screen and (min-device-width: 375px) and (max-device-height: 667px) and (orientation : portrait) and (-webkit-device-pixel-ratio: 2){
/* Styles go here.. */
}
/* ------ iPhone 6+ ----------- */
@media only screen and (min-device-width: 414px) and (max-device-height: 736px) and (orientation : landscape) and (-webkit-device-pixel-ratio: 2){
/* Styles go here.. */
}
@media only screen and (min-device-width: 414px) and (max-device-height: 736px) and (orientation : portrait) and (-webkit-device-pixel-ratio: 2){
/* Styles go here.. */
}
/* ------ Samsung Galaxy S3,S4,S5 ----------- */
@media only screen and (min-device-width: 320px) and (max-device-height: 640px) and (orientation : landscape) and (-webkit-device-pixel-ratio: 3){
/* Styles go here.. */
}
@media only screen and (min-device-width: 320px) and (max-device-height: 640px) and (orientation : portrait) and (-webkit-device-pixel-ratio: 3){
/* Styles go here.. */
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment