html - 媒体查询最大宽度 992px 不适用于 ipad 横向 View

标签 html css ipad media-queries

当我在 iPad 上查看横向 View 时,CSS 媒体查询 max-width: 992px 不工作,响应式布局仍然可见(但在桌面上它在 992px 处中断)。感谢您的帮助。

<meta name="viewport" content="width=device-width" />

我的 CSS 媒体查询:

.responsive_button{display:none;}

@media only screen and (max-width: 992px) {
   .responsive_button{display:block;}
}
@media only screen and (max-width: 768px) {}
@media only screen and (max-width: 480px) {}
@media only screen and (max-width: 320px) {}

最佳答案

iPad 分辨率为:

  • 768 像素 x 1024 像素(纵向)
  • 1024 像素 x 768 像素(横向)

如果你想定位 ipad 的不同方向,请使用下面的媒体查询,注意方向也已指定。

纵向 iPad

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

横向 iPad:

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

关于html - 媒体查询最大宽度 992px 不适用于 ipad 横向 View ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29194971/

相关文章:

html - 如何删除页脚下方的空白区域?

html - 除非我尝试通过检查工具(检查元素)触摸该元素的 CSS,否则 Google Chrome 浏览器不会显示背景图像

iphone - UIWebView 和取消点击手势

iphone - 有没有办法改变模态视图 Controller 外观的动画样式?

javascript - 按钮无法与 onclick 和 JavaScript 一起使用

css - 如何减少 Clarity Accordion 组件的宽度?

javascript - 悬停时 CSS tile 翻转

ios - UIStatusBarStyleBlackTranslucent 在此设备上不可用

html - 如何防止行内 block 元素堆叠?

javascript - 在 Chrome 中将 &lt;script&gt; 标记附加到 <head> 失败