android - 关于 max-width 属性的 CSS 媒体查询使平板电脑和桌面的大小为 1024px

标签 android html css

我仍在努力弄清楚媒体查询是如何工作的。我有两个媒体查询,一个针对 ma​​x-width: 1024px,另一个针对平板电脑的 ma​​x-device-width: 1024px

我面临的问题是,当我在我的 iPAD 上测试它时,它会跳过 ma​​x-device-width: 1024px 并选择 ma​​x-width: 1024px .

我的问题是如何为台式机和平板电脑编写最大宽度 1024px 的媒体查询?

我想要一个宽度为 1024 的台式机和平板电脑的原因是因为我需要不同的样式。

我的 CSS 代码如下。

  @media screen and (max-device-width: 1024px) and (orientation: portrait)
        {#cast1, #cast2, #cast3, #cast4, #cast5, #cast6, #cast7 
          {
            height: 26%;left: 5%;
          }
       } 

  @media screen and (max-width: 1024px)
       {#cast1, #cast2, #cast3, #cast4, #cast5, #cast6, #cast7 
          {
            height: 45%;left: 5%;
          }
       }

最佳答案

这套媒体查询适用于“平板电脑和桌面电脑”

移动

only screen and (min-width: 480px) { ... }

平板电脑

only screen and (min-width: 480px) { ... }
only screen and (min-width:321px) and (max-width:768px) { ... }
only screen and (min-width: 768px)  { ... }

桌面

only screen and (min-width: 992px) { ... }

巨大

only screen and (min-width: 1280px) { ... }

关于android - 关于 max-width 属性的 CSS 媒体查询使平板电脑和桌面的大小为 1024px,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41973452/

相关文章:

android - 如何通过添加搜索查询的 Intent 启动 GoogleNow?

android - 如何在android中对齐通知内容文本

android - 找不到适用于 Firestore Android 的方法 whereArrayContains()

javascript - 如何在列表中添加删除按钮?

html - 为什么表格的存在会破坏垂直对齐?

html - 如何将容器定位在 <p> 元素内,文本在其周围流动?

java - 将android应用程序库中的图像上传到本地spring服务器

jQuery 返回假;打破复选框

java - CSS3 风格的 Java?

html - 添加额外元素时标题和正文之间奇怪的额外间距