How to avoid iOS automatic font size adjustment?

Solution 1:

body {
    -webkit-text-size-adjust: 100%;
}

Just make sure all your text is at a legible size in the first place. The iPhone and iPod touch have a rather small screen, so keep that in mind too.

Solution 2:

Had a lot of trouble tracking it down, but: it’s the -webkit-text-size-adjust property in CSS.

Read more about it and other iOS-specific CSS here.

Values:

  • Percentage (of default size), e.g. 120%, or 100%
  • auto (the default)
  • none – if auto isn’t working for your page. However this often causes problems with zooming. Use 100% instead. For example, open Safari on your desktop and zoom the page (Command-Plus) – your text won’t be enlarged, even though the entire page has zoomed! Don’t use none!

Note that these can be applied not just at the page level but at the element/widget/container level.

(I would not just specify a value of 100% for my website unless I was damn sure it was already optimized for small screens, and never none since it causes problems.)


Please note that in Firefox Mobile (e.g. for Android and Firefox OS) there is a similar property, -moz-text-size-adjust, documented here. Thanks to Costa for pointing this out.


Apparently Microsoft also has a version of this for mobile IE: -ms-text-size-adjust.


Update, 10 years later: This MDN page is probably best for checking what browsers' current compatibilities and vendor prefixes are for this property.

Solution 3:

The accepted answer works, but in other webkit browsers it locks in the font-size for people that are zooming. Using 100% instead of none works both ways:

body {
    -webkit-text-size-adjust: 100%;
}