When you use a mobile device to browse the Web, you will find that some of the pages can be scaled or not. What is this for?
This is because there is a property control in the meta of the Web page.
<meta content= "width=device-width; initial-scale=1.0; maximum-scale=1.0; User-scalable=0 "name=" viewport ">
This meta tag indicates that the width of the document is forced to remain 1:1 with the width of the device, and the maximum width of the document is 1.0, and the user is not allowed to click on the screen to zoom in.
The viewport in Meta has a total of 5 attributes, as follows:
<meta name= "Viewport"
Content= "
Height = [Pixel_value |device-height],
width = [Pixel_value |device-width],
Initial-scale = float_value, Minimum-scale = float_value, Maximum-scale = Float_value,
User-scalable =[yes | no],
target-densitydpi = [Dpi_value | device-dpi| high-dpi | medium-dpi | low-dpi] "/>
which
widthWidth of the –viewport
heightThe height of the –viewport
initial-scale– Initial zoom ratio
minimum-scale– The minimum scale to allow the user to zoom
maximum-scale– Allows the user to zoom to the maximum scale
user-scalable– Whether the user can manually scale
target- densitydpi-Declares the device's scale, default value medium-dpi , (the property other parameters specific meaning please continue to look down)
Extended Knowledge:
<meta content= "yes" name= "apple-mobile-web-app-capable" ><meta content= "Black" name= " Apple-mobile-web-app-status-bar-style "><meta content=" Telephone=no "name=" Format-detection "><meta Name= "Viewport" content= "target-densitydpi=device-dpi, Width=device-width" >
The first meta tag is the safari private meta tag in the iphone device, which says: Allow full-screen mode browsing;
The second meta tag is also the iphone's private label, which specifies the style of the iphone's status bar on the top of safari;
The third meta tag means: Tell the device to ignore numbers on the page as phone numbers
The fourth meta tag is also the one that says scaling on the viewport, but here's the concern that target-densitydpi=device-dpi this is telling the device 1 CSS pixels = 1 device pixels. There are several optional values for this property
device-dpi– Use the original DPI of the device as the target DP. No default scaling occurs.
high-dpi– Use hdpi as the target dpi. Medium pixel density and low pixel density devices are scaled down accordingly.
medium-dpi– Use MDPI as the target dpi. High pixel density devices are scaled accordingly, and pixel density devices are scaled down accordingly. This is the default target density.
low-dpi-use MDPI as the target dpi. Medium pixel density and high pixel density devices are scaled accordingly.
dpi_value– Specify a specific DPI value as the target dpi. The range of this value must be between 70–400.
Settings for page scaling in mobile devices