【问题标题】:Responsive css is not working响应式 CSS 不起作用
【发布时间】:2016-11-21 02:01:34
【问题描述】:

我正在使用

为设备分辨率编写单独的 css

@media only screen and (min-width: 320px) and (max-width: 480px) and (orientation: portrait) { // css goes here }

和设备分辨率

@media only screen and (min-width: 360px) and (max-width: 640px) and (orientation: portrait) { // css goes here }

但是360px*640(orientation:portrait) css 不工作。它采用默认的 320px*480px CSS。 我如何编写在360px*640(orientation:portrait) 设备上工作的css。

【问题讨论】:

  • 让我们看看你的代码
  • 在 360px*640 上使用 !important
  • 编辑您的问题以包含您的代码,使用工具正确格式化它
  • 编辑您的问题以包含您的代码,使用工具正确格式化它

标签: css responsive-design media-queries


【解决方案1】:

试试这个:

@media only screen 
  and (min-width: 320px)
  and (max-width: 360px) 
  and (orientation: portrait) {
  // 360px width goes here
}

@media only screen 
  and (max-width: 320px) 
  and (orientation: portrait) {
  // 320px width goes here
}

【讨论】:

  • max-device-* 和 min-device-* 已弃用。请改用max-* 和min-*
  • 320 是宽度,480 是高度,那为什么都是max-width 和min-width?
猜你喜欢
  • 1970-01-01
  • 2019-11-06
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2013-03-19
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多