html - 设备屏幕@media 查询

标签 html css media-queries

我在 CSS 中有媒体查询:

@media only screen and (max-device-width: 480px) and (min-device-width: 320px)

当我在 Google Chrome 中打开 elements inspector 并选择设备 iPhone 4 时,它显示的屏幕与原始 iPhone 4s 屏幕和其他一些手机屏幕不同。为什么?我做错了什么?

如何在我的谷歌浏览器或其他浏览器中查看 iPhone 4 页面的原始外观?有什么解决办法吗?

它在 iPhone 4 上的外观: How it shows in iPhone 4

当我选择设备 iPhone 4(在左上角)时,它在 Google Chrome 中的显示方式: how it shows in Google Chrome, when I select device: iPhone 4 (on the top left)

最佳答案

代替

(max-device-width: 480px) and (min-device-width: 320px)

仅使用

(max-width: 480px) and (min-width: 320px)

为什么?

min/max-width

The width media feature describes the width of the rendering surface of the output device (such as the width of the document window, or the width of the page box on a printer).

min/max-device-width

Determines whether the output device is a grid device or a bitmap device. If the device is grid-based (such as a TTY terminal or a phone display with only one font), the value is 1. Otherwise it is zero.

关于html - 设备屏幕@media 查询,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33964416/

相关文章:

jQuery,获取所有克隆输入字段的所有值

html - 在导航中居中文本(水平和垂直)

javascript - 突出显示 anchor 的目标元素中的元素?

html - Bootstrap Responsive Carousel 无法正确调整大小

css - Bootstrap 响应式设计的奇怪行为

html - 元视口(viewport)标签和 css 媒体查询的问题

css - 不同设备上的视口(viewport)和像素密度使图标变得模糊

javascript - 如何转义 JavaScript 变量中的单引号

javascript - 通过Jquery给选中的li添加类

javascript - eventListener 和封闭元素