解決蘋果手機底部橫杠兼容問題


 1
  /*媒體查詢的方式 添加class名即可*/
@media only screen and (device-width:375px) and (decive-height:812px) and (-webkit-device-pixel-ratio:3){ 2 .content-bottom{ 3 padding-bottom:34px !important; 4 background-color: #fff !important 5 } 6 } 7 8 @media only screen and (device-width:375px) and (decive-height:812px) and (-webkit-device-pixel-ratio:2){ 9 .content-bottom{ 10 padding-bottom:34px !important; 11 background-color: #fff !important 12 } 13 } 14 15 @media only screen and (device-width:414px) and (decive-height:896px) and (-webkit-device-pixel-ratio:3){ 16 .content-bottom{ 17 padding-bottom:34px !important; 18 background-color: #fff !important 19 } 20 } 21 22 @media only screen and (device-width:414px) and (decive-height:896px) and (-webkit-device-pixel-ratio:2){ 23 .content-bottom{ 24 padding-bottom:34px !important; 25 background-color: #fff !important 26 } 27 }
/*通過查詢手機型號來進行適配*/
if (/iphone/gi.test(navigator.userAgent) && (screen.height == 812 && screen.width == 375)) {
//是iphoneX
console.log('是iphonex')
} else {
//不是iphoneX
console.log('不是iphonex')
}
 
         

  

 

 詳解:https://blog.csdn.net/dx18520548758/article/details/80010358


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM