Viewport Tag Syntax

2019-02-13 12:09发布

问题:

I have been looking on the web and I'm still confused on which works and does not. I see errors on chrome when I use the semi-colon, but the iPhone recognizes it. The comma works also without errors. I'm wondering which one is qualified as the correct way of writing it.

Semi Colons -

<meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;" />

Commas -

<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" / >

http://developer.apple.com/library/safari/#documentation/AppleApplications/Reference/SafariHTMLRef/Articles/MetaTags.html

I'm just looking for a correct interpretation of why I have this error if both work, especially why it throws an error on Chrome.

EDIT: woops, forgot the code tags. updated.

回答1:

Commas are the correct delimiters for viewport properties. iPhone Safari (and other browsers) might be more forgiving and interpret semicolons as delimiters as well, but then you're relying on the browser's error handling.