它们都意味着什么?
我知道初始比例与缩放有关,我只是不知道1-10的意思是什么值.
资料来源:https://www.w3.org/TR/css-device-adapt-1/#translate-meta-to-at-viewport
解决方法
<Meta name="viewport" content="width=device-width,initial-scale=1">
在标记内,width属性控制视口的大小.它可以设置为像width = 400这样的精确像素数,也可以设置为特殊值设备宽度值,它是CSS像素中屏幕宽度的100%. device-width是响应式网站最常用的宽度,可扩展到不同的屏幕尺寸.
首次加载页面时,initial-scale属性控制初始缩放级别,即1个视口像素= 1个CSS像素.用户可扩展,最大规模和最小规模属性控制用户如何缩放或缩小页面.
您可以设置示例html页面并包含viewport标记并更改initial-scale属性以查看差异.还可以尝试在不同的视口大小和方向上查看页面.
initial-scale: The initial zoom when visiting the page. 1.0 does not zoom.
要回答initial-scale = 2.0意味着这里是使用2.0的一个例子:
In addition to the above,you may want to specify the initial zoom factor for the viewing area. If you want to set the viewport of your page to be equal to the device’s width and have it zoom in by default with a factor of 2 for example,this property will come in handy. The code for that would look as follows:.
The Image above shows what this would look like — although it is not a particularly practical demonstration of the possibilities the initial scale setting has to offer,the underlying point should be clear: content is blown up with a factor of 2 upon first load.
https://dev.opera.com/articles/an-introduction-to-meta-viewport-and-viewport/#initial-scale
一些很好的结帐参考:
https://css-tricks.com/snippets/html/responsive-meta-tag/
https://css-tricks.com/probably-use-initial-scale1/