用于定位 Apple 2018 设备:iPhone XR/XS/XS Max 的正确 CSS 媒体查询是什么?
iPhone XR
/* 1792x828px at 326ppi */
@media only screen
and (device-width : 414px)
and (device-height : 896px)
and (-webkit-device-pixel-ratio : 2) { }
iPhone XS
/* 2436x1125px at 458ppi */
@media only screen
and (device-width : 375px)
and (device-height : 812px)
and (-webkit-device-pixel-ratio : 3) { }
iPhone XS Max
/* 2688x1242px at 458ppi */
@media only screen
and (device-width : 414px)
and (device-height : 896px)
and (-webkit-device-pixel-ratio : 3) { }
正在寻找特定的方向?
Portrait
添加以下规则:
and (orientation : portrait)
景观
添加以下规则:
and (orientation : landscape)
参考:
- https://developer.apple.com/design/ human-interface-guidelines/ios/visual-design/adaptivity-and-layout/ https://developer.apple.com/design/human-interface-guidelines/ios/visual-design/adaptivity-and-layout/
- https://www.paintcodeapp.com/news/ultimate-guide-to-iphone-分辨率 https://www.paintcodeapp.com/news/ultimate-guide-to-iphone-resolutions
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)