Technical Q&A QA1560

Why am I getting odd, unexpected results with various viewport tag settings

Q:  Why am I getting odd, unexpected results with various viewport tag settings?

A: The most likely cause is that you are using semicolons to separate property/value pairs in your viewport declaration as shown in Listing 1.

Listing 1  Incorrect viewport declaration

<meta name="viewport" content="width=device-width; user-scalable=no">

The viewport tag uses commas to separate property/value pairs. Semicolons are not valid delimiters or separators, and will result in undefined behavior on your webpage. See Listing 2, which correctly declares the viewport tag.

Listing 2  Correct viewport declaration

<meta name="viewport" content="width=device-width, user-scalable=no">

Read Safari Web Content Guide > Configuring the Viewport for more information about viewports.



Document Revision History


DateNotes
2014-08-05

Editorial update. Removed all self-closing tags.

2007-11-29

New document that advocates the use of commas to separate property/value pairs in the viewport declaration.