html - 元视口(viewport)标签中 "initial-scale"的最小值是多少?

标签 html css viewport meta

在试验 meta viewport 标签时,我注意到初始比例的任何小于 0.25 的值都被视为 0.25。例如。以下所有内容

<meta name="viewport" content="width=device-width, initial-scale=0.25">  
<meta name="viewport" content="width=device-width, initial-scale=0.1">  
<meta name="viewport" content="width=device-width, initial-scale=0.01">  
<meta name="viewport" content="width=device-width, initial-scale= ">

渲染页面相同。所以,

  • Is the minimum allowed vale of "initial-scale" in meta viewport tag 0.25?
  • What is the default value of initial-scale?
  • Why don't initial scale take it's default value, instead of taking 0.25, when blank space is given to initial scale as initial-scale=?

最佳答案

W3C 状态

The initial-scale, minimum-scale, and maximum-scale properties

The properties are translated into 'zoom', 'min-zoom', and 'max-zoom' respectively with the following translations of values.

  1. Non-negative number values are translated to values, clamped to the range [0.1, 10]
  2. Negative number values are dropped
  3. yes is translated to 1
  4. device-width and device-height are translated to 10
  5. no and unknown values are translated to 0.1

来源:https://www.w3.org/TR/css-device-adapt-1/#translate-meta-to-at-viewport

在上面给出的情况下,最小值应该是 0.1,默认值是 0.1,当没有设置值时,使用默认值。

所以您测试它的浏览器很可能使用默认值,但由于它似乎不低于 0.25,因为它不在您的测试用例中,所以不能说它是否使用默认。

关于html - 元视口(viewport)标签中 "initial-scale"的最小值是多少?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36382743/

相关文章:

php - 浏览器/手机检测有哪些可用的解决方案

javascript - 切换流量图

javascript - 如何每页显示 2 或 3 张幻灯片?

Python:从网页中抓取视频(在 HTML 中不可见)

css - 修复浏览器中的视口(viewport)以响应站点

python - 如何使用 Opengl 在 pygame 中制作可调整大小的窗口

html - 使用 Bootstrap 4 的导航下拉悬停

html - Bootstrap 网格和列偏移

jquery - 固定图片位置

css - 网站无法在移动设备中正确显示