When testing my responsive webpage in browsers by resizing the window and using simulators, everything was fine. Now I’ve just tested the page on my real iPhone 4S with strange results.
When loading the page in vertical view, everything is good, switching to horizontal view is also not a problem.
But when I turn the phone again so that it enters vertical view again, something strange happens. The vertical version is displayed, but it seems that the body does not properly resize. I get a big empty area on the right and a vertical scrollbar, while the elements on the webpage are displayed on the left. Screenshots:
Vertical #1
Horizontal
Vertical #2
This is the CSS code I have on my body (Note: I am still working on that project, so the colors and the font is only temporarily written like that):
body {
margin: 0;
background-color: grey;
color: black;
font-family: Georgia, serif;
line-height: 1.5;
background-image: url(../img/bg.png);
}
And I also use em based media queries, like:
@media only screen and (min-width: 30em) {
/* Stuff */
}
Inside the media queries I don’t change anything on the body.
In the head of my HTML file I have
<meta name="viewport" content="width=device-width, initial-scale=1.0">
Some debugging showed me, that the body element resizes correctly, but the html element does not.
Do you have any idea what could cause that problem?
Ok, I finally figured this out! See this Question, it’s the exact problem I am having.
HTML5 Placeholder Text Adding Width In Safari Causing Scrollbars And Flickering