I made an HTML page that has an <input>
tag with type="text"
. When I click on it using Safari on iPhone, the page becomes larger (auto zoom). Does anybody know how to disable this?
Open the Settings app on the iPhone or iPad. Scroll down and choose the Safari browser from Settings. From Safari Settings, select the Page Zoom Safari option. Within the window, tap to select the Zooming level.
In the viewport meta tag above:maximum-scale=1 fixes the maximum scale of the page to 1.0. This prevents Safari from auto-zooming while still allowing the user to zoom in manually.
Solution 1Set the window and body to a size that fills the screen-space, without exceeding it. This is why so many people have success with forcing input text-size to 16px; once you do that, its clear that you're WAY zoomed out.
There is no way to disable the auto zoom. If you want to see the maximum amount of the screen the only way to do so is to make the input as wide as the screen and use a single-column form.
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.
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
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.
input[type="color"], input[type="date"], input[type="datetime"], input[type="datetime-local"], input[type="email"], input[type="month"], input[type="number"], input[type="password"], input[type="search"], input[type="tel"], input[type="text"], input[type="time"], input[type="url"], input[type="week"], select:focus, textarea { font-size: 16px; }
It's not necessary to use all the above, you can just style the elements you need, eg: just text
, number
, and textarea
:
input[type='text'], input[type='number'], textarea { font-size: 16px; }
Alternate solution to have the input elements inherit from a parent style:
body { font-size: 16px; } input[type="text"] { font-size: inherit; }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With