让我的网站默认在手机上缩小 [英] Get my website to be zoomed out by default on mobile phones

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

问题描述

因此,我希望用户能够在我的网站上看到我的背景.目前,我的网站宽度为925px,当您在移动浏览器(例如iPhone,Opera Mini)中浏览该网站时,它会放大文本,而用户看不到背景.

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

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

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

解决方案

我知道这是一个老问题,但是无论如何我都会回答,以防其他人需要答案.

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

尝试一下:

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

当包含width=device-width时,浏览器神奇地" **查找内容区域并对其进行调整以填充设备的宽度.如果您想浏览背景,则需要缩小整个页面以适合视口.

完全省略<meta name=viewport>也可以,但是通常您会看到较少的背景图像.

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

**使用某种启发式方法,浏览器开发人员将能够比我更好地进行解释.

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.

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

EDIT:

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.

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.)

Try this:

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

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.

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天全站免登陆