
Progressive Web App Road Show 2016
Stopping in New York, Chicago, Austin, Toronto, Mountain View and Seattle. Learn more and sign up now.

Progressive Web App Road Show 2016
Stopping in New York, Chicago, Austin, Toronto, Mountain View and Seattle. Learn more and sign up now.
Pages optimized for a variety of devices must include a meta viewport element in the head of the document. A meta viewport tag gives the browser instructions on how to control the page's dimensions and scaling.
width=device-width to match the screen's width in device-independent pixels.initial-scale=1 to establish a 1:1 relationship between CSS pixels and device-independent pixels.To attempt to provide the best experience, mobile browsers will render the page at a desktop screen width (usually about 980px, though this varies across devices), and then try to make the content look better by increasing font sizes and scaling the content to fit the screen. For users, this means that font sizes may appear inconsistently and they have to double-tap or pinch-to-zoom in order to see and interact with the content.
<meta name="viewport" content="width=device-width, initial-scale=1">Using the meta viewport value width=device-width instructs the page to match the screen’s width in device-independent pixels. This allows the page to reflow content to match different screen sizes, whether rendered on a small mobile phone or a large desktop monitor.
Some browsers will keep the page’s width constant when rotating to landscape mode, and zoom rather than reflow to fill the screen. Adding the attribute initial-scale=1 instructs browsers to establish a 1:1 relationship between CSS pixels and device-independent pixels regardless of device orientation, and allows the page to take advantage of the full landscape width.
In addition to setting an initial-scale, you can also set the following attributes on the viewport:
minimum-scalemaximum-scaleuser-scalableWhen set, these can disable the user’s ability to zoom the viewport, potentially causing accessibility issues.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 3.0 License, and code samples are licensed under the Apache 2.0 License. For details, see our Terms of Service.