禁用移动设备上的缩放以固定视口大小 [英] Disable zoom on mobile devices for fixed viewport size

查看:64
本文介绍了禁用移动设备上的缩放以固定视口大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试禁用移动设备上的缩放。
我知道此代码将起作用。

I am trying to disable zoom on mobile devices. I know this code will work.

<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />

但就我而言,我没有选择使用 width = device-width。我必须将视口大小设置为480px,因此我正在使用以下代码

But in my case, i have not the option to use "width=device-width". I have to set the viewport size to 480px so i am using the following code

<meta name="viewport" content="width=480px, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />

但是我可以放大移动设备上的页面,并且可以缩小页面。

But i get a zoomed in view of the page on mobile device and i am able to zoom it out.

推荐答案

使用 target-densitydpi = device-dpi,并使用代码

Using "target-densitydpi=device-dpi" and hence the code

<meta name="viewport" content="width=480, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0,target-densitydpi=device-dpi, user-scalable=no" />

解决了我的问题。感谢 Dave Rook

fixed my problem. Thanks to Dave Rook

这篇关于禁用移动设备上的缩放以固定视口大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆