见我的例子页面在这里:如何让移动设备上的缩放像PC上一样?
http://fireman-suppression-84203.bitballoon.com
尽量放大,在这个页面中的PC(台式电脑),并尝试放大(用手指)你智能手机,你可以看到区别?当文字变大时,在PC浏览器(例如Chrome)上进行缩放时,它会停留在屏幕的左/右限制上,但是当您试图放大iPhone时,文本会超出左侧&右边界,你需要左右读取所有内容。
如何使智能手机上的缩放(在我的情况下为iPhone 7)与在PC上缩放相同?我希望唯一需要滚动的是上下滚动,我不希望页面内容(文本,图片......)溢出到两边(并且不,我不想禁用缩放选项手机)。
下面是代码:
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<style>
div {
width:85%;
margin: auto;
border: 3px solid #73AD21;
}
</style>
</head>
<body>
<div>Just an example text... Just an example text... Just an example text... Just an example text... Just an example text... Just an example text... Just an example text... Just an example text... Just an example text... Just an example text... Just an example text... Just an example text... Just an example text... Just an example text... Just an example text... Just an example text... Just an example text... Just an example text... Just an example text... Just an example text... Just an example text... Just an example text... Just an example text... Just an example text... </div>
<br>
</body>
</html>
我也试过这样:
<meta content='width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0' name='viewport'/>
这:
<meta name="viewport" content="width=device-width,initial-scale=1">
但它并没有帮助。
顺便说一句 -
有时候,我看到这样写的 '视' 元行:
<meta ...>
,有时它是这样写的是:
<meta .../>
的区别是什么这两个之间?这两个选项合法吗?
谢谢!
喜@Tomas,你尝试过“用户可升级”设置为yes或1这里是链接[链接] https://css-tricks.com/snippets/html/responsive-meta-tag/ [/链接] – bdalina