
For example, if you set the scale to 1.0, Safari assumes the width is device-width in portrait and device-height in landscape orientation. If only a subset of the properties are set, then Safari on iOS infers the other values. You do not need to set every viewport property. For example, use device-width instead of 320 for the width, and device-height instead of 480 for the height in portrait orientation.

When referring to the dimensions of a device, you should use the constants described in Table 2 instead of hard-coding specific numeric values. If the parameter doesn’t begin with a number, the value is 0. For example, 1.0x is equivalent to 1.0 and 123x456 is equivalent to 123. Follow these rules when setting multiple properties:Ī space may work as a delimiter, but a comma is preferred.įor numeric properties, if the value contains a nonnumeric character but starts with a number, then the number prefix is used as the value. When providing multiple properties for the viewport meta key, you should use a comma-delimited list of assignment statements. Table 1 describes the properties supported by the viewport meta key and their default values. If you are designing a Safari on iOS-specific web application, you should set the width to the width of the device. Typically, you use the viewport meta tag to set the width and initial scale of the viewport.įor example, if your webpage is narrower than 980 pixels, then you should set the width of the viewport to fit your web content.

Use the viewport meta key to improve the presentation of your web content on iOS.
