css判断iphoneX、iphoneXs、iphoneXs Max、iphone XR

阅读 (3336)
iphoneX、iphoneXs、iphoneXs Max、iphone XR 都是3倍屏,宽度到是不大,但尼玛高是真高啊!

/* 兼容iphone6plus、iphone7plus、iphone8plus*/
@media (device-height:736px) and (-webkit-min-device-pixel-ratio:2){
    
}
/*iphoneX、iphoneXs*/
/*即: 设备屏幕可见宽度为375px, 可见高度为812px及设备像素比为3*/
@media only screen and (device-width: 375px) and (device-height: 812px) and (-webkit-device-pixel-ratio: 3) {
    
}
 

/*iphone Xs Max*/
@media only screen and (device-width: 414px) and (device-height: 896px) and (-webkit-device-pixel-ratio:3) {
    
}

/*iphone XR*/
@media only screen and (device-width: 414px) and (device-height: 896px) and (-webkit-device-pixel-ratio:2) {
    
}

 

更新于:2019-03-13 10:21:30
返回顶部