如何居中对齐 iPhone 的最大比例视口缩放

发布于 2024-09-28 13:29:06 字数 209 浏览 1 评论 0原文

当我设置最大比例并且来回旋转方向时,网页不会在手机上居中。

那么使用这段代码

  <meta name="viewport" content="width=device-width; initial-scale=0; maximum-scale=2;">

如何模仿margin: 0 auto;的CSS效果。

When I set a maximum scale and when I rotates orientations back and forth, the web page isn't centered on the phone.

So using this code

  <meta name="viewport" content="width=device-width; initial-scale=0; maximum-scale=2;">

How can I mimic the CSS effect of margin: 0 auto;.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

我还不会笑 2024-10-05 13:29:06

对于从 Google 到达这里的人,您还应该查看 Apple 上的以下页面[1]。

视口标签非常有用。

[1]:http://developer. apple.com/library/IOS/#documentation/AppleApplications/Reference/SafariWebContent/UsingtheViewport/UsingtheViewport.html 使用 ViewPort

For people arriving here from Google, you should also look at the following page on Apple[1].

The viewport tag is quite helpful.

[1]: http://developer.apple.com/library/IOS/#documentation/AppleApplications/Reference/SafariWebContent/UsingtheViewport/UsingtheViewport.html Using the ViewPort

獨角戲 2024-10-05 13:29:06

您需要在另一个包装器内部有一个包装器才能使其正常工作。外部的 CSS 如下:

#wrapper {
min-width: 320px;
max-width: 480px;
}

内部的 CSS 如下:

#inside-wrapper {
min-width: 300px;
max-width: 460px;
margin: 0 auto;
}

您仍然可以使用 margin: 0 auto;

You will need to have a wrapper inside of another wrapper to get this to work. The outside one will have the following CSS:

#wrapper {
min-width: 320px;
max-width: 480px;
}

And the inside one will have the following:

#inside-wrapper {
min-width: 300px;
max-width: 460px;
margin: 0 auto;
}

You can still use margin: 0 auto;

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文