Android 如何为移动设备扩展网站?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2361846/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-20 05:32:44  来源:igfitidea点击:

How to scale a website for mobile devices?

androidcssiphonemobile-website

提问by koby

I've a very simple static web page (only css and links, no scripts). It looks good on android and iphone, but too small. I'm guessing they put it smaller since it work for most of the sites. How can I override this and make him look the size I want it to be?

我有一个非常简单的静态网页(只有 css 和链接,没有脚本)。它在 android 和 iphone 上看起来不错,但太小了。我猜他们把它缩小了,因为它适用于大多数网站。我怎样才能覆盖它并使他看起来像我想要的大小?

回答by TomHastjarjanto

Android automatically adjusts to the size of your site, try to use width:100% or smaller than around 310 pixels (scrollbar takes space) for normal viewmode.

Android 会自动调整到您网站的大小,尝试使用 width:100% 或小于 310 像素左右(滚动条占用空间)的普通视图模式。

For IPhone try using this code to force the correct size

对于 iPhone 尝试使用此代码强制正确的大小

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

Also to force font-size try to use this code in your css:

同样要强制字体大小,请尝试在您的 css 中使用此代码:

-webkit-text-size-adjust: none;

回答by dergachev

<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">

The list should be comma-separated.

该列表应以逗号分隔。