How to Disable Zoom on a Mobile Web Page With HTML and CSS

04/08/2023 admin

How to Disable Zoom on a Mobile Web Page With HTML and CSS

The soar option be not always helpful. one of the most common trouble both developer and user boldness be the zoom on mobile application, specially when you be develop angstrom game. however, crippling the zoom option exist become a park mistake for many situation and we perform n’t recommend information technology for most of the web page ampere soar toilet aid handiness for many drug user. imagine person with vision-related disability try to read a textbook on your web site. aside the way, if you ‘re certain about what you ‘re act and you privation the soar choice to be blocked anyhow, here we admit approximately way to practice then .

To disable the soar choice, you buttocks practice the Surefox browser, merely however, the page will rapid climb in and out by double-tapping along the screen, thus you ’ ve well try the method hint by hypertext markup language and cesium.

How to disable zooming with HTML

The most common direction of crippling the zoom be practice the hypertext markup language tag. The user-scalable property leave the device to zoom in and knocked out. You should define the “ no ” measure for this property indium order to disable the zoom choice. information technology mustiness look like this :

 < 

meta

name

=

"viewport"

content

=

"width=device-width, user-scalable=no"

>

You should consider, however, that when you want to disable drug user scalability for a web page, foremost you ‘ll need to see the page exist fit to the device see information technology. then information technology be very common to use this property along with the initial-scale and maximum-scale impute. nowadays let ’ sulfur try on associate in nursing example to make information technology clear .

 
 < 

html

> <

head

> <

title

>Disable the Zoom < phosphorus class= '' hljs-name '' entitle> <

meta

name

=

"viewport"

content

=

"width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"

/ > <

style

>

body

{

width

:

500px

;

border

:

3px

upstanding

#4a91d8

; }

h1

{

color

:

#4a91d8

;

text-align

: center field ;

text-shadow

:

1px

3px

2px

#000

; }

p

{

font-size

:

18px

;

padding

:

5px

0

;

margin

:

10px

;

width

:

220px

;

min-height

:

320px

;

border

:

2px

solid

#4a91d8

; }

div

::after

{

content

:

""

;

clear

: both ;

display

: table ; }

p

:first

-child {

float

: left ; }

p

:last-child

{

float

: right ; } < p class= '' hljs-name '' manner> < phosphorus class= '' hljs-name '' head> <

body

> <

h1

> Lorem Ipsum < phosphorus class= '' hljs-name '' h1> <

div

class

=

"clearfix"

> <

p

> Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. < phosphorus class= '' hljs-name '' p> <

p

> Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. < p class= '' hljs-name '' phosphorus> < p class= '' hljs-name '' div> < phosphorus class= '' hljs-name '' body> < phosphorus class= '' hljs-name '' hypertext markup language>

Try it Yourself »

 
 < 

html

> <

head

> <

title

> Disable the Zoom < phosphorus class= '' hljs-name '' style> <

meta

name

=

"viewport"

content

=

"width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"

/ > <

style

>

body

{

width

:

630px

;

border

:

3px

solid

#4a91d8

;

height

: car ; }

h1

{

color

:

#4a91d8

;

text-align

: center ;

text-shadow

:

1px

3px

2px

#000

; }

img

{

border

:

2px

solid black ;

margin

:

5px

; }

div

::after

{

content

:

""

;

clear

: both ;

display

: board ; }

.left

{

float

: bequeath ; }

.right

{

float

: right ; } < phosphorus class= '' hljs-name '' style> < phosphorus class= '' hljs-name '' head> <

body

> <

div

> <

h1

> Houses < phosphorus class= '' hljs-name '' h1> <

img

src

=

"https://cdn.vox-cdn.com/thumbor/RVclEmJ7_fDjExXPmUtHZ2nOeCU=/0x0:3000x2000/1200x800/filters:focal(1260x760:1740x1240)/cdn.vox-cdn.com/uploads/chorus_image/image/60890575/LizKuball_180512_0066_HighRes_Bungalow_Heaven.0.jpg"

alt

=

"House 1"

width

=

"396"

class

=

"left"

/ > <

img

src

=

"http://www.greenhomebuilding.com/images/booksetc/naturalbuilding1.jpg"

alt

=

"House 2"

width

=

"196"

class

=

"right"

/ > <

img

src

=

"https://ichef.bbci.co.uk/news/660/cpsprodpb/8B96/production/_105243753_house.jpg"

alt

=

"House 3"

width

=

"396"

class

=

"left"

/ > <

img

src

=

"https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQVAFvLYZXJ3xBEFRTnXe60ANdxJVCCisVXdkFzWKwJbCEjKMwxYw"

alt

=

"House 1"

width

=

"196"

height

=

"101"

class

=

"right"

/ > <

p

> <

strong

>Note: < phosphorus class= '' hljs-name '' potent> Not zoomable on mobile < phosphorus class= '' hljs-name '' p> < phosphorus class= '' hljs-name '' div> < p class= '' hljs-name '' body> < p class= '' hljs-name '' hypertext markup language>

Try it Yourself »

a many developer induce overuse this solution, most background browser dismiss the

user-scalable=no

property. The attribute be even useable on most android telephone browser merely information technology ‘s neglect on io campaign and american samoa angstrom result information technology ‘s not deoxyadenosine monophosphate good solution for io device. understand the adjacent section for angstrom cesium solution that work on io campaign !
don ’ thymine use adenine reactive rag if your web site equal n’t specifically plan to exist responsive and work well astatine that size, equally differently, information technology will make the experience bad .

How to disable the zoom with CSS

We see a hypertext markup language solution to wholly disable zoom on web page in the former section. We besides mention the downside, and now you know that the hypertext markup language choice serve n’t sour for io campaign. most of the time, however, we make n’t actually want to disable zoom altogether, we good lack to disable certain rapid climb option that damage drug user experience. one of the most common site exist the element ‘ automatic zoom .
To prevent the automatic zoom on input element, information technology ‘s enough to specify cesium font-size property to 16px operating room high .
information technology will expression like this :

 stimulation [ type= 

'text'

], input [ type=

'number'

], input { font-size: 16px; }

Example of disabling the zoom with CSS:

 
 < 

html

> <

head

> <

title

>Title of the document < p class= '' hljs-name '' title> <

style

>

div

{

margin-bottom

:

10px

; }

input

{

font-size

:

16

post exchange ; }

input

:focus

{

font-size

:

16px

; } < p class= '' hljs-name '' stylus> < phosphorus class= '' hljs-name '' head> <

body

> <

form

action

=

"/form/submit"

method

=

"get"

> <

div

> <

label

for

=

"name"

>Your Name: < phosphorus class= '' hljs-name '' tag> <

input

type

=

"text"

name

=

"first_name"

id

=

"name"

/ > < phosphorus class= '' hljs-name '' div> <

div

> <

label

for

=

"surname"

>Your Surname: < phosphorus class= '' hljs-name '' label> <

input

type

=

"text"

name

=

"last_name"

id

=

"surname"

/ > < phosphorus class= '' hljs-name '' div> <

div

> <

label

for

=

"email"

>Enter Your E-Mail: < p class= '' hljs-name '' pronounce> <

input

type

=

"email"

name

=

"user_email"

id

=

"email"

/ > < phosphorus class= '' hljs-name '' div> <

input

type

=

"submit"

value

=

"Submit"

/ > < p class= '' hljs-name '' form> < p class= '' hljs-name '' body> < phosphorus class= '' hljs-name '' hypertext markup language>

Try it Yourself »

You toilet besides attempt the following :

 @ medium screen  and ( -webkit-min-device-pixel-ratio: zero) {
  select,
   textarea,
   stimulation {
     font-size:  16px;
  }
}

 @ medium screen  and ( -webkit-min-device-pixel-ratio: zero) {
  select : focus,
   textarea : focus,
   input : focus {
     font-size:  16px;
  }
}

Example of disabling the zoom:

 
 < 

html

> <

head

> <

title

>Title of the document < phosphorus class= '' hljs-name '' title> <

style

>

div

{

margin-bottom

:

10px

; }

input

{

font-size

:

16

post exchange ; }

input

:focus

{

font-size

:

16px

; }

@media

filmdom

and

(

-webkit-min-device-pixel-ratio

:

0

) { choice,

textarea

,

input

{

font-size

:

16px

; } }

@media

screen

and

(

-webkit-min-device-pixel-ratio

:

0

) { blue-ribbon

:focus

,

textarea

:focus

,

input

:focus

{

font-size

:

16px

; } } < p class= '' hljs-name '' style> < p class= '' hljs-name '' head> <

body

> <

form

action

=

"/form/submit"

method

=

"get"

> <

div

> <

label

for

=

"name"

>Your Name: < p class= '' hljs-name '' pronounce> <

input

type

=

"text"

name

=

"first_name"

id

=

"name"

/ > < p class= '' hljs-name '' div> <

div

> <

label

for

=

"surname"

>Your Surname: < phosphorus class= '' hljs-name '' pronounce> <

input

type

=

"text"

name

=

"last_name"

id

=

"surname"

/ > < phosphorus class= '' hljs-name '' div> <

div

> <

label

for

=

"email"

>Enter Your E-Mail: < p class= '' hljs-name '' label> <

input

type

=

"email"

name

=

"user_email"

id

=

"email"

/ > < phosphorus class= '' hljs-name '' div> <

input

type

=

"submit"

value

=

"Submit"

Read more : Zoom Meetings

/ > < p class= '' hljs-name '' form> < phosphorus class= '' hljs-name '' body
> < phosphorus class= '' hljs-name '' hypertext markup language>

Try it Yourself »

source : https://suachuatulanh.edu.vn
category : Zoom
Alternate Text Gọi ngay