I’ve recently been getting back into iPhone development with the iPhone 5’s new screen and the need to update some of my Apps for the new phone and operating system. As you probably already know, the new 4-inch screen is yet another set of dimensions programmers needs to take into account. The new screen is 1136 pixels wide by 640 pixels in portrait mode. So far I’ve had great luck with the following CSS Media Query for my Portrait only apps, which uses 568px as the fixed device height (times 2.0 pixel ratio equals the 1136px across).
1 2 3 |
@media screen and (device-height: 568px) and (orientation: portrait) and (-webkit-min-device-pixel-ratio: 2) { // css here } |
@media screen and (device-height: 568px) and (orientation: portrait) and (-webkit-min-device-pixel-ratio: 2) { // css here }
This works well mostly because of the -webkit-min-device-pixel-ratio parameter, which detects the retina display in accordance with the higher resolution.
Let me know below what you are using!
Yours hit the spot… had tried at least three other queries, with no luck. Thanks! 🙂
Nice one! Will use this for my phone gap app!
Thanks for dropping this knowledge. Turns out -webkit-min-device-pixel-ratio enables device aspect ratio parameters also.
@media screen and (device-aspect-ratio: 40/71) and (-webkit-min-device-pixel-ratio: 2) {
//iphone5
}