项目需要区分iphone x 和iphone 8p 的某个padding高度,以此来适应锚点距离导航栏的位置,直接放代码吧 iphone x:
/*add for iphone-x*/
@media only screen
and (min-device-width : 375px)
and (max-device-width : 812px)
and (-webkit-device-pixel-ratio : 3) {
/*add some code*/
}
/*add for iphone 8p*/
@media only screen
and (min-device-width : 414px)
and (max-device-width : 736px){
/*add some code*/
}
复制代码
iphone 8p 和 iphone x的device-pixel-ratio 都是3; 大家可以扫描测试自己设备的device-pixel-ratio 链接http://www.zhangxinxu.com/study/201208/window-device-pixel-ratio.html