Disable Auto Zoom in Input “Text” tag - Safari on iPhone (ok)
https://stackoverflow.com/questions/2989263/disable-auto-zoom-in-input-text-tag-safari-on-iphone
518
The browser will zoom if the font-size is less than 16px
and the default font-size for form elements is 11px
(at least in Chrome and Safari).
Additionally, the select
element needs to have the focus
pseudo-class attached.
It's not necessary to use all the above, you can just style the elements you need, eg: just text
, number
, and textarea
:
Alternate solution to have the input elements inherit from a parent style:
You can prevent Safari from automatically zooming in on text fields during user input without disabling the user’s ability to pinch zoom. Just add maximum-scale=1
but leave out the user-scale attribute suggested in other answers.
It is a worthwhile option if you have a form in a layer that “floats” around if zoomed, which can cause important UI elements to move off screen.
New: IOS will still zoom, unless you use 16px on the input without the focus.
I added a background since IOS adds no background on the select.
Last updated
Was this helpful?