gpt4 book ai didi

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

转载 作者:太空狗 更新时间:2023-10-29 14:12:42 24 4
gpt4 key购买 nike

在试验 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/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com