Viewport Tag Syntax

2019-02-13 11:50发布

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条回答
Explosion°爆炸
2楼-- · 2019-02-13 12:17

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.

查看更多
登录 后发表回答