Search code examples
cssiphonemobile-safariscreen-orientation

iPhone Safari CSS rotation bug


I have a small mobile phone app that is acting strangely on the iPhone/Mobile Safari. The page renders and works great when it's orientation is vertical. When I rotate the phone horizontally some, but not all elements on the page resize correctly. Some header elements will stay nearly their same size, maybe increasing by 10%, others will double in size.

Has anyone run into this? My first thought was that the css could have a mix of sizes based on ems and px's but finding every size element and converting them to em's didn't change a thing.


Solution

  • It's because Mobile Safari on iPhone & iPod Touch does automatic font-size adjustment.

    You can disable it with the following css rule,

    html {-webkit-text-size-adjust:none}

    More info from Safari Reference Library