Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get my website to be zoomed out by default on mobile phones

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">
like image 494
Kredns Avatar asked Aug 30 '10 05:08

Kredns


People also ask

Why is website zoomed in mobile?

Basically, it adjusts the content based on the zoom level set by users and remembers that. So, going forward, if a user visits a web page on the browser, it opens it up in the same zoom settings. The Page Zoom is the same feature just for the mobile version of Chrome.

How do I turn off zoom on my mobile website?

We can use the <meta> tag to disable zoom in and out on a mobile web page.

How do I resize my mobile site?

A recommended approach is to use “resolution switching,” with which it is possible to instruct the browser to select and use an appropriate size image file depending on the screen size of a device. Switching the image according to the resolution is accomplished by using two attributes: srcset and sizes.

How do I stop web pages from zooming in?

By default, Chrome sets the zoom level to 100%. To manually adjust the settings, use the Ctrl key and “+” or “-” combos to increase or decrease the page magnification. If you are using a mouse, you can hold down the keyboard Ctrl key and use the mouse wheel to zoom in or out.


3 Answers

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.

like image 188
webinista Avatar answered Oct 07 '22 19:10

webinista


After much trial and error I got the following to work correctly on iPhone 5.0.1 and Android 2.3.6. The site was designed for a 480 width. Depending on the width of your site you have to play around with the width value for the iPhone.

<meta name="viewport" content="width=520, target-densitydpi=high-dpi" />
<meta http-equiv="Content-Type" content="application/vnd.wap.xhtml+xml; charset=utf-8" />
<meta name="HandheldFriendly" content="true" />
<meta name="apple-mobile-web-app-capable" content="yes" /> 
like image 26
Nomad77 Avatar answered Oct 07 '22 20:10

Nomad77


I'm surprised meta viewport didn't work for you (on Mobile Safari). Can you post what you used?

UPDATE: This generally works for me... give it a try:

<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0" />

If that works, you can then start playing with the scale values to let users zoom if they want to, and by how much.

like image 42
donohoe Avatar answered Oct 07 '22 19:10

donohoe