How to center alignment of scaled viewport scaling for iphone

When I set the maximum zoom and when I rotate the orientation back and forth, the web page is not centered on the phone.

So using this code

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

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

+5
source share
2 answers

You will need to have a shell inside another shell to make it work. External can have the following CSS:

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

And inside inside will be the following:

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

You can still use margin: 0 auto;

+2
source

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

The viewport tag is very useful.

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

+4

All Articles