如何在默认情况下让手机上的网站被缩小? [英] How can I get my website to be zoomed out by default on mobile phones?

查看:179
本文介绍了如何在默认情况下让手机上的网站被缩小?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我希望用户能够在我的网站上看到我的背景。目前我的网站宽度是 925px ,当您在移动浏览器(例如iPhone,Opera Mini)中查看网站时,它放大文本,用户看不到背景。

So I want users to be able to see my background on my website. Currently my websites width is 925px and when you view the website in a mobile browser (e.g. iPhone, Opera Mini) it is zoomed in on the text and the user can't see the background.

我尝试使用 meta viewport 标记失败。如何在移动浏览器中将我的网站默认缩小?

I've tried using the meta viewport tag unsuccessfully. How do I get my website to be zoomed out by default on mobile browsers?

编辑:

下面是我到目前为止尝试过的代码:

Here is the code I've tried so far:

<meta name = "viewport" content = "width = device-width">


推荐答案

我知道这是一个老问题,

I know this is an old question, but I am answering anyway in case someone else needs the answer.

截至2011年9月,Opera Mini仍在使用Presto渲染引擎的2.5版本。 Viewport在Presto 2.7之前在Opera中不可用。 (Opera Mobile,我们的智能手机浏览器 支持视口。)

As of September 2011, Opera Mini is still using version 2.5 of the Presto rendering engine. Viewport isn't available in Opera until Presto 2.7. (Opera Mobile, our smart phone browser does support viewport.)

尝试:

<meta name="viewport" content="initial-scale=0.25">

当您包含 width = device-width ,浏览器magically**找到内容区域并调整它以填充设备的宽度。

When you include width=device-width, the browser 'magically'** finds the content area and adjusts it to fill the width of the device. If you want the background to peek through, you'll need to shrink the entire page to fit within the viewport.

离开<元名称(如果您希望背景通过,您需要缩小整个页面以适应视口) = viewport> 完全也可以,但你通常会看到更少的背景图片。

Leaving <meta name=viewport> out entirely will also work, but you will typically see less of the background image.

但是,理想情况下,您还应该使用媒体查询来创建以各种宽度工作的网站。

Ideally, however, you should also use media queries to create a site that works at a variety of widths.

**使用某种浏览器开发人员能够比我更好地解释的启发式。

** Using heuristics of some kind that a browser developer would be able to explain better than I can.

这篇关于如何在默认情况下让手机上的网站被缩小?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆