视口问题
我想让我的页面适合屏幕,无论分辨率如何并且不允许缩放。 我在很多文档/资源中看到,这是使用视口调整屏幕上整个页面的最佳方式。 (甚至 jquerymobile 也会生成此视口)
<meta name="viewport" content="width=device-width, minimum-scale=1, maximum-scale=1">
但它只显示页面的某些部分。
但这段代码按预期工作。整个页面都适合屏幕
<meta name="viewport" content="user-scalable=0;" />
有什么区别?
I want to fit my page on the screen, whatever resolution is there and not allowing scaling.
I have seen in alot of documents/resource that this is the best way of using viewport to adjust the whole page on the screen. (even jquerymobile generate this viewport)
<meta name="viewport" content="width=device-width, minimum-scale=1, maximum-scale=1">
but It only show some portion of the page.
But this code works as excpected. The whole page is fit on the screen
<meta name="viewport" content="user-scalable=0;" />
Whats the difference?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
此
meta
标记要求您的文档宽度为设备宽度。 jQuery Mobile 使用它是因为 jQuery Mobile 确保它将根据设备宽度调整文档宽度。如果你想在 320px 宽的屏幕上放置 980px 宽的页面,那么你必须在meta
标签中设置 980px:如果你不知道你的文档宽度,你必须先获取它并然后设置
meta
标记属性。This
meta
tag requires that your document width is device width. jQuery Mobile uses it because jQuery Mobile make sure that it will adjust document width according to device width. If you want to put a 980px wide page in a 320px wide screen, then you have to set 980px in themeta
tag:If you don't know your document width, you have to get it first and then set the
meta
tag property.