O'Reilly logo

jQuery and JavaScript Phrasebook by Brad Dayley

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Defining the Viewport Meta Tag

<meta name="viewport" content="width=device-width,   initial-scale=1">

A critical component of using jQuery Mobile is adding the viewport settings in a <meta> tag inside the page <head> tag. The viewport defines how the browser displays the page zoom level and the dimensions used.

Specifically, you need to set the content="width=device-width, initial-scale=1" as shown next. These settings force the device’s browser to render the web page width at exactly the number of pixels available on the device:

<meta name="viewport" content="width=device-width,   initial-scale=1">

Without specifying the viewport setting, the mobile page is at a much higher size ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required