简体   繁体   English

为什么Chrome Developer Tools在模拟移动设备时会设置如此大的视口大小?

[英]Why Chrome Developer Tools set such a big viewport size when emulating mobile?

I have a test document as follows: 我有一份测试文件如下:

<html>
  <head></head>
  <body></body>
</html>

So it's just an empty document. 所以它只是一个空文档。 In normal browser mode, I get an nice empty page, no scrolls. 在普通的浏览器模式下,我得到一个漂亮的空页,没有滚动。

But when I open devtools and turn on mobile emulation (for example, Sony Xperia Z, Z1), I see scroll bars (both horizontal and vertical), and html element size is 980x1742. 但是当我打开devtools并开启移动仿真时(例如,Sony Xperia Z,Z1),我看到滚动条(水平和垂直),html元素大小为980x1742。 Where does this come from? 这是从哪里来的? Shouldn't it be at least zero height? 它不应该至少为零高度?

To make your page the exact size of the screen (no zooming or otherwise), place this in the header: 要使您的页面成为屏幕的确切大小(无缩放或其他),请将其放在标题中:

<meta name="viewport" content="width=device-width, initial-scale=1">

There's some more info about it, as well as additional parameters you may find useful, on Mozilla's developer site here . 这里也有一些关于它的更多信息,以及其他参数,可能对你有用,Mozilla的开发者网站在这里

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 chrome 开发者工具中的 DPR 是什么? 它是如何使用的,为什么? - What is DPR in chrome developer tools? How is it used and why? 为什么android浏览器视口比手机的实际屏幕尺寸小得多,即使使用width = device-width? - Why android browser viewport is much smaller than actual screen size of the mobile phone, even when using width=device-width? 移动浏览器的视口大小意外 - Unexpected viewport size for mobile browser 移动视口尺寸大于屏幕尺寸吗? - is mobile viewport size larger than screen size? Google Chrome 开发者工具:Android 调试返回 HTTP/1.1 404 Not Found。 为什么? - Google Chrome Developer Tools : Android Debugging returns HTTP/1.1 404 Not Found. Why? 用于设备的Chrome开发者工具搞砸了 - Chrome Developer Tools for a device messed up 如何获取具有元视口大小的移动设备的实际视口? - How to get the actual viewport of a mobile device that has a meta viewport size? chrome 模拟设备的 Oneplus 6 视口大小 - Oneplus 6 viewport size for chrome Emulated Devices 当字体大小设置为大时,可组合行元素消失 - Composable Row elements disappear when the font size is set to big chrome开发人员工具上的“保存时间轴数据...”产生一个0字节的文件 - “Save Timeline data…” on chrome developer tools produces a 0 bytes file
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM