在 Firefox 中禁用触摸模拟呈现 HTML/CSS 不同

Disabling Touch Simulation in Firefox Renders HTML/CSS Differently

我是 web-dev 的新手,不知道这是否按预期工作,但这对我来说似乎很奇怪。简而言之,禁用触摸均匀模拟会导致我的网页以不同方式呈现(见附图)。这是由于我的代码、Firefox 开发工具还是其他原因造成的?

谢谢。

Code Here: Codepen

您需要将以下代码添加到 head 部分(在 title 标记之前):

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

来自HEAD

  • meta name="viewport" - viewport settings related to mobile responsiveness
  • width=device-width means that it will use the physical width of the device (instead of zooming out) which is good with mobile friendly pages
  • initial-scale=1 is the initial zoom, 1 means no zoom

有关 viewport 标签的更多信息,请参阅:Using the viewport meta tag to control layout on mobile browsers