在使用 Safari 的 iPad 上,转到此页面:http: //ifelse.org/projects/errors/viewport/test.html
这是来源:
<html>
<head>
<title>Viewport Test</title>
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
<meta name="viewport" content="width=1030" />
<style>
body {
padding: 0;
margin: 0;
}
#test {
width: 1024px;
height: 500px;
border: 3px solid #ccc;
}
</style>
</head>
<body>
<div id="test">
<p>This is 1024 with a 3px border, so device width is 1030.</p>
<p>Works when viewing in Mobile Safari.</p>
<p>Does not work if you Bookmark it to the Home Screen and open from there.</p>
<p>Compare <a href="viewport_1030_safari.png">MobileSafari</a> view to <a href="viewport_1030_webapp.png">Webapp</a> view.</p>
</div>
</body>
</html>
它应该看起来像这个图像,其中viewport
1030 像素在纵向模式下完全可见:
- 点击书签图标(+)
- 点击添加到主屏幕
- 创建书签。打开书签,网页将以 webapp 模式全屏打开。
该viewport
标签基本上被忽略了。我已经尝试了多种使用设备和混合像素值的变体。没有。
那么......这是一个错误还是一个功能?
如果这是 Apple 有意为之,那么它本质上意味着要正确开发美观的 Web 应用程序,您需要使用 768px 的实际宽度...?