isIOS () { var u = navigator.userAgent; var isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); //ios终端 return isiOS }
针对 Ihone 6 及 Ihone X 高度问题的媒体查询
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
// iPhoneX @mediaonly screen and (device-width:375px) and (device-height:812px) and (-webkit-device-pixel-ratio:3) { .wrap { .main { padding-top: 490px; } } } // iPhone 6 @mediaonly screen and (min-device-width:375px) and (max-device-width:667px) and (width:667px) and (height:375px) and (orientation: landscape) and (color:8) and (device-aspect-ratio:375/667) and (aspect-ratio:667/375) and (device-pixel-ratio:2) and (-webkit-min-device-pixel-ratio:2) { .wrap { .main { padding-top: 300px; } } }