Skip to content

Instantly share code, notes, and snippets.

@movii
Last active December 3, 2018 09:30
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 movii/e3e2bc4353f4b6e6de0c0ef0b248bfb2 to your computer and use it in GitHub Desktop.
Save movii/e3e2bc4353f4b6e6de0c0ef0b248bfb2 to your computer and use it in GitHub Desktop.
Combined CSS Media Query for iPhone X/Xs, iPhone Xs Max, iPhone XR.
/*
* reference:
* 1. ref: https://www.paintcodeapp.com/news/ultimate-guide-to-iphone-resolutions
* 2. https://stackoverflow.com/questions/52321212/iphone-xr-xs-xs-max-css-media-queries
* 3. https://stackoverflow.com/questions/46313640/iphone-x-8-8-plus-css-media-queries
*/
/*
* iPhone X & iPhone XS
* 2436px x 1125px at 458ppi
*/
@media
only screen
and (device-width : 375px)
and (device-height : 812px)
and (-webkit-device-pixel-ratio : 3)
and (orientation : portrait),
/*
* iPhone XR
* 1792px x 828px at 326ppi
*/
only screen
and (device-width : 414px)
and (device-height : 896px)
and (-webkit-device-pixel-ratio : 2)
and (orientation : portrait),
/*
* iPhone XS Max
* 2688px x 1242px at 458ppi
*/
only screen
and (device-width : 414px)
and (device-height : 896px)
and (-webkit-device-pixel-ratio : 3)
and (orientation : portrait) {
/*
* styles goes here...
*/
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment