css - 媒体查询在 iPad Pro 上无法正常工作

标签 css ipad media-queries

我为 3 种类型的设备设置了访问者门户:移动设备(宽度小于 800 像素)、低分辨率桌面和高分辨率桌面,如下所示:

<link media="only screen and (min-width: 801px) and (max-height: 899px)" href="..." rel="stylesheet" type="text/css">   
<link media="only screen and (min-width: 801px) and (min-height: 900px)" href="..." type="text/css">   
<link media="only screen and (max-width: 800px)" href="..." rel="stylesheet" type="text/css">

所有这些都运行良好,但对于 iPad Pro 竖屏,屏幕宽度小于 800 像素,但选择的样式表是低分辨率桌面。我需要更改什么才能使其正常工作?

编辑(澄清问题)

当我做这样的事情时

<link media="only screen and (min-width: 801px) and (max-height: 899px)" href="..." rel="stylesheet" type="text/css">
<link media="only screen and (min-width: 801px) and (min-height: 900px)" href="..." rel="stylesheet" type="text/css">
<link media ="only screen and (max-width: 800px),
only screen and (max-device-width:1024px) and (-webkit-min-device-pixel-ratio:1.1) and (orientation:portrait),
only screen and (max-device-height:1366px) and (-webkit-min-device-pixel-ratio:1.1) and (orientation:landscape)"
href="..." rel ="stylesheet" type="text/css">

问题是样式在不同的分辨率下会混淆。我希望让它工作,以便在任何时候只有一个样式表处于事件状态。

最佳答案

iPad 媒体查询

iPad 媒体查询(所有世代 - 包括 iPad mini)

纵向和横向的 iPad

@media only screen 
and (min-device-width : 768px) 
and (max-device-width : 1024px)  { /* STYLES GO HERE */}

iPad 横屏

@media only screen 
and (min-device-width : 768px) 
and (max-device-width : 1024px) 
and (orientation : landscape) { /* STYLES GO HERE */}

纵向 iPad

@media only screen 
and (min-device-width : 768px) 
and (max-device-width : 1024px) 
and (orientation : portrait) { /* STYLES GO HERE */ }

要了解有关设备媒体查询的更多信息,请访问 Stephen.io/mediaqueries 来源学分http://stephen.io/mediaqueries/

希望对您有所帮助。

谢谢

关于css - 媒体查询在 iPad Pro 上无法正常工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48440257/

相关文章:

html - 导航栏下拉按钮上的向下箭头

jquery - 更改 css 值(左 :x) if a browser viewport is <1200px

objective-c - UISplitViewController 中缺少 UIBarButtonItem

iPhone 5 CSS 媒体查询

javascript - jQuery 不需要的向上滚动

html - 为什么 ul 和第一个 li 元素之间有一个空格?

iOS 应用程序认证和临时测试

ios - 如何在iOS/iPad中使用纬度,经度和海拔高度绘制3D轮廓?

css - 响应式 CSS 显示 :none and media queries

iphone - 如何仅为特定设备设置视口(viewport)?