开发者

How to center align the maximum-scale viewport zoom for iphone

When I set a maximum scale and when I rotates orientations back and forth, the web page isn't 开发者_JS百科centered on the phone.

So using this code

  <meta name="viewport" content="width=device-width; initial-scale=0; maximum-scale=2;">

How can I mimic the CSS effect of margin: 0 auto;.


For people arriving here from Google, you should also look at the following page on Apple[1].

The viewport tag is quite helpful.

[1]: http://developer.apple.com/library/IOS/#documentation/AppleApplications/Reference/SafariWebContent/UsingtheViewport/UsingtheViewport.html Using the ViewPort


You will need to have a wrapper inside of another wrapper to get this to work. The outside one will have the following CSS:

#wrapper {
min-width: 320px;
max-width: 480px;
}

And the inside one will have the following:

#inside-wrapper {
min-width: 300px;
max-width: 460px;
margin: 0 auto;
}

You can still use margin: 0 auto;

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜