2018-11-30 13:26:41 555浏览
今天扣丁学堂iOS培训老师给大家介绍一下关于iPhoneX媒体查询适配的方法教程,希望对同学们iOS开发有所帮助,下面我们一起来看一下吧。
@media only screen and (min-width: 375px) and (max-width: 767px) { /* Your Styles... */ }AppleiPhoneXMin-Width媒体查询
@media only screen and (min-width: 375px) { /* Your Styles... */ }AppleiPhoneXMin-Height媒体查询
@media only screen and (min-height: 812px) { /* Your Styles... */ }AppleiPhoneXLandscape媒体查询
@media only screen and (min-width: 812px) and (orientation: landscape) { /* Your Styles... */ }AppleiPhoneXPortrait媒体查询
@media only screen and (min-width: 375px) and (orientation: portrait) { /* Your Styles... */ }AppleiPhoneXRetina媒体查询
@media only screen and (-webkit-min-device-pixel-ratio: 3), only screen and ( min--moz-device-pixel-ratio: 3), only screen and ( -o-min-device-pixel-ratio: 3/1), only screen and ( min-device-pixel-ratio: 3), only screen and ( min-resolution: 458dpi), only screen and ( min-resolution: 3dppx) { /* Retina styles here */ }视网膜实际上是基于设备像素比率。设备大多具有2x或3x显示屏,因此您可以使用一般的视网膜媒体查询在所有类型的设备上显示高分辨率内容。Retina2x和Retina3x媒体查询如下:
@media only screen and (-webkit-min-device-pixel-ratio: 2), only screen and ( min--moz-device-pixel-ratio: 2), only screen and ( -o-min-device-pixel-ratio: 2/1), only screen and ( min-device-pixel-ratio: 2), only screen and ( min-resolution: 192dpi), only screen and ( min-resolution: 2dppx) { /* Retina styles here */ }Retina3x媒体查询
@media only screen and (-webkit-min-device-pixel-ratio: 3), only screen and ( min--moz-device-pixel-ratio: 3), only screen and ( -o-min-device-pixel-ratio: 3/1), only screen and ( min-device-pixel-ratio: 3), only screen and ( min-resolution: 384dpi), only screen and ( min-resolution: 3dppx) { /* Retina styles here */ }
@media only screen and (min-device-width: 320px) and (max-device-height: 480px) and (-webkit-device-pixel-ratio: 1) { }/*iphone4*/
@media only screen and (min-device-width: 320px) and (max-device-height: 480px) and (-webkit-device-pixel-ratio: 2) { }/*iphone5*/
@media only screen and (min-device-width: 320px) and (max-device-height: 568px) and (-webkit-device-pixel-ratio: 2) { }/*iphone6,6s*/
@media only screen and (min-device-width: 375px) and (max-device-height: 667px) and (-webkit-device-pixel-ratio: 2) { }/*iphone7,8*/
@media only screen and (min-device-width: 375px) and (max-device-height: 667px) and (-webkit-device-pixel-ratio: 2) { }
@media only screen and (min-device-width: 414px) and (max-device-height: 736px) and (-webkit-device-pixel-ratio: 3) { }以上就是关于扣丁学堂iOS培训之iPhoneX媒体查询适配的方法教程的全部内容,希望对大家的学习有所帮助,扣丁学堂IT职业在线学习教育平台为您提供权威的iOS开发环境搭建视频,iOS培训后的前景无限,行业薪资和未来的发展会越来越好的,通过千锋扣丁学堂金牌讲师在线录制的iOS开发教程,让你快速掌握iOS从入门到精通开发实战技能。
【关注微信公众号获取更多学习资料】