加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 资源网站 > 资源 > 正文

html – 什么是initial-scale = 1.0?

发布时间:2020-12-14 18:35:47 所属栏目:资源 来源:网络整理
导读:我无法找到关于initial-scale = 1.0和initial-scale = 2.0意味着什么的明确定义. 它们都意味着什么? 我知道初始比例与缩放有关,我只是不知道1-10的意思是什么值. 资料来源:https://www.w3.org/TR/css-device-adapt-1/#translate-meta-to-at-viewport 解决
我无法找到关于initial-scale = 1.0和initial-scale = 2.0意味着什么的明确定义.

它们都意味着什么?

我知道初始比例与缩放有关,我只是不知道1-10的意思是什么值.

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

解决方法

通常的移动响应站点将在头部包含HTML元标记,如下所示:
<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/

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读