针对移动浏览器进行优化

发布于 2024-11-18 02:03:13 字数 293 浏览 3 评论 0原文

我有一个在服务器上生成的简单网页。它有简单的文本字段、单选按钮、标签和类似的东西(非常类似于简单的表单)。我正在尝试针对移动浏览器进行优化。我想用尽可能多的 CSS 来完成它,并且我想找到一种支持 iphone、android 和流行的移动操作系统的方法。

我的问题是,我可以设计页面样式,以便字段始终占据手机宽度的 100%、标签将换行等等,但也可以使用户无法放大或缩小并显示缩放比例iphone4 或 iphone3g 是否能正确地查看它?

我已经使用元标记找到了答案的一些部分,但我似乎无法找到一种方法使缩放始终正确,无论分辨率如何。

I have a simple web page that is generated on the server. It has simple text fields, radio buttons, labels and things like that (much resembling a simple form). I'm trying to optimize this for mobile browsers. I'd like to do it in as much CSS as possible, and I'd like to find a way to support iphone, android and the popular mobile OSes.

My question is this, can I style the page so that fields will always take 100% of the width of the phone, labels will wrap,and so on, but also make it so the user cannot zoom in or out and have the scaling appear correctly weather an iphone4 or an iphone3g is looking at it?

I've found bits and pieces of my answer using meta tags, but I can't seem to find a way to make the scaling always right, regardless of the resolution.

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

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

发布评论

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

评论(1

你与清晨阳光 2024-11-25 02:03:13
<meta name="viewport" content="width=device-width, user-scalable=no" />

这对于 iOS 来说效果很好,但在 BlackBerry 和 Android 的横向视图中,页面保持在左侧并且不会放大。我认为如果没有明确设置,这与 iOS 推断高度(和其他属性)有关,而其他平台可能需要 height=device-width 设置。

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

This works great for iOS, but in landscape view of BlackBerry and Android, the page stays on the left and doesn't scale up. I think this has something to do with iOS inferring height (and other attributes) if not explicitly set, while other platforms might need the height=device-width set.

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