Responsive site is zoomed in when flipping between Portrait and Landscape on iPad/iPhone
I've built a responsive site using Twitter Bootstrap here: http://zarin.me/cce/
The responsive design works great on iPad and iPhone, however when I flip the device from portrait to landscape, the site is zoomed in instead of adapting to the screen (pinching the screen works).
What am I missing? Is this a viewport issue? Here's the only viewport code I have in my :
<meta content="width=device-width, initial-scale=1.0" name="viewport">
Thanks in advance!
You also want to add the maximum scale
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
UPDATED I agree with some of the comments, the declaration should not limit the scaling by the user as this is bad practice. The below is a better approach and I believe that the zooming bug has long since been fixed by Apple.
<meta name="viewport" content="width=device-width, initial-scale=1">
While setting the maximum scale to "1" does work, it restricts your users from zooming in on anything within your site. Not ideal for user experience. Try this Javascript instead, iOS-Orientation Change Fix
Set initial-scale=1.0
in the meta:
<meta name="viewport" content="width=device-width,initial-scale=1.0" />
Then set -webkit-text-size-adjust:100%;
in the CSS:
body {
-webkit-text-size-adjust: 100%;
}
This approach doesn't stop a user from zooming in on your website but will ensure that the text doesn't get size adjusted automatically by the browser.
I've seen this happening when one of the containers on the page spills past 100%. The page displays ok in the initial orientation, but when the orientation is changed the extra width somehow becomes in force, causing the page to scale in, and usually leaves a margin on the right or left. Worth checking all your media queries to make sure there is not some trailing padding or margin.