iPhone X / 8 / 8 Plus CSS media queries

后端 未结 5 2104
猫巷女王i
猫巷女王i 2020-12-02 05:02

What are the CSS media queries corresponding to Apple\'s new devices ? I need to set the body\'s background-color to change the X\'s safe area back

5条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-02 05:13

    Here are some of the following media queries for iPhones. Here is the ref link https://www.paintcodeapp.com/news/ultimate-guide-to-iphone-resolutions

            /* iphone 3 */
            @media only screen and (min-device-width: 320px) and (max-device-height: 480px) and (-webkit-device-pixel-ratio: 1) { }
            
            /* iphone 4 */
            @media only screen and (min-device-width: 320px) and (max-device-height: 480px) and (-webkit-device-pixel-ratio: 2) { }
            
            /* iphone 5 */
            @media only screen and (min-device-width: 320px) and (max-device-height: 568px) and (-webkit-device-pixel-ratio: 2) { }
            
            /* iphone 6, 6s, 7, 8 */
            @media only screen and (min-device-width: 375px) and (max-device-height: 667px) and (-webkit-device-pixel-ratio: 2) { }
                
            /* iphone 6+, 6s+, 7+, 8+ */
            @media only screen and (min-device-width: 414px) and (max-device-height: 736px) and (-webkit-device-pixel-ratio: 3) { }
            
            /* iphone X , XS, 11 Pro, 12 Mini */
            @media only screen and (min-device-width: 375px) and (max-device-height: 812px) and (-webkit-device-pixel-ratio: 3) { }
    
            /* iphone 12, 12 Pro */
            @media only screen and (min-device-width: 390px) and (max-device-height: 844px) and (-webkit-device-pixel-ratio: 3) { }
           
            /* iphone XR, 11 */
            @media only screen and (min-device-width : 414px) and (max-device-height : 896px) and (-webkit-device-pixel-ratio : 2) { }
                
            /* iphone XS Max, 11 Pro Max */
            @media only screen and (min-device-width : 414px) and (max-device-height : 896px) and (-webkit-device-pixel-ratio : 3) { }
    
            /* iphone 12 Pro Max */
            @media only screen and (min-device-width : 428px) and (max-device-height : 926px) and (-webkit-device-pixel-ratio : 3) { }
    
    

提交回复
热议问题