Use the viewport meta tag to improve the performance of your page on your device, typically by setting the width and initial scale of the viewport (viewport).
For example, if the width of the page is less than 980px, you can set the viewport width to fit the page. If you are developing a Web application, you should set the width of the viewport to the width of the device.
Table 1 describes the properties supported by the viewport META tag and their default values. When there are multiple properties, you should use commas to separate assignment expressions. When setting multiple properties, follow these rules:
- do not use semicolons as delimiters.
- spaces can also be used as separators, but it is best to use commas.
- is a property whose value is a number, and if the property value contains a non-numeric character but begins with a number, only the part of the number is treated as a property value. For example, 1.0x is equivalent to 1.0,123x456 equivalent to 123. If the argument does not start with a number, the property has a value of 0.
When you want to use the dimension data for a device, you can use the constants in table 2 instead of numeric values. For example, replace 320 (width) with device-width, and replace 480 (height) with device-height.
You do not need to set each property, and the property that is not set automatically takes the default value.
Sets the width of the viewport to the width of the device:
<meta name= "viewport" content= "width=device-width";
Set initial zoom ratio to 1.0:
<meta name= "viewport" content= "initial-scale=1.0";
Sets the initial scale and disables user scaling.
<meta name= "viewport" content= "initial-scale=2.3, User-scalable=no"
Sets the width of the viewport to the width of the device, maximum and minimum scaling, Prohibit user scaling (common)
<meta name= "viewport" content= "Width=device-width, minimum-scale=1.0, maximum-scale=1.0, User-scalable=no ";