問題描述
我在瀏覽一個網站的源代碼時,發現了這段代碼.
I was going through the source code of a website and found this piece of code.
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=1.0, minimum-scale=1.0, maximum-scale=1.0">
我想知道這個初始比例、用戶可縮放、最小比例、最大比例是什么,這些值是什么意思?并告訴我他們接受的所有價值觀.
I want to know what this initial scale, user-scalable, minimum-scale, maximum-scale are and what does those values mean? And also tell me what all values they accepts.
推薦答案
它們是視口元標記,最適用于移動瀏覽器.
They are viewport meta tags, and is most applicable on mobile browsers.
這意味著,我們告訴瀏覽器我的網站適應您的設備寬度".
This means, we are telling to the browser "my website adapts to your device width".
這定義了網站的縮放比例,這個參數設置了初始縮放級別,這意味著1 CSS pixel等于1 viewport pixel.當您更改方向或阻止默認縮放時,此參數會有所幫助.沒有這個參數,響應式網站將無法工作.
This defines the scale of the website, This parameter sets the initial zoom level, which means 1 CSS pixel is equal to 1 viewport pixel. This parameter help when you're changing orientation, or preventing default zooming. Without this parameter, responsive site won't work.
Maximum-scale 定義最大縮放.當您訪問網站時,最高優先級是maximum-scale=1
,并且不允許用戶縮放.
Maximum-scale defines the maximum zoom. When you access the website, top priority is maximum-scale=1
, and it won’t allow the user to zoom.
Minimum-scale 定義最小縮放.這與上面的工作方式相同,但它定義了最小比例.這很有用,當 maximum-scale
很大,并且您想設置 minimum-scale
.
Minimum-scale defines the minimum zoom. This works the same as above, but it defines the minimum scale. This is useful, when maximum-scale
is large, and you want to set minimum-scale
.
用戶可縮放分配給 1.0 表示網站允許用戶放大或縮小.
User-scalable assigned to 1.0 means the website is allowing the user to zoom in or zoom out.
但是如果你把它分配給user-scalable=no
,這意味著網站不允許用戶放大或縮小.
But if you assign it to user-scalable=no
, it means the website is not allowing the user to zoom in or zoom out.
這篇關于什么是元標記中的初始比例、用戶可縮放、最小比例、最大比例屬性?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!