简体   繁体   中英

Viewport meta for android default browser

I'm trying to display an image (320x480px) in a webpage on android. I'm trying to configure the viewport meta cause I want the image displayed in full screen.

Actually I simply configured the viewport like that

<meta name="viewport" content="width=320px" />

and it's working perfectly, except with the android default browser. I tried Chrome, Opera and Firefox, and they all display the image correctly.

Regarding this post Full webpage and disabled zoom viewport meta tag for all mobile browsers I tried to configure it in this way without success :

<meta name="viewport" content="initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0,width=device-width,height=device-height,target-densitydpi=device-dpi,user-scalable=yes" />

or

<meta name="viewport" content="initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0,width=320,height=device-height,target-densitydpi=device-dpi,user-scalable=yes" />

Do you have any idea on how to configure the viewport correctly ?

Thank You

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

user-scalable - controls wither the user can "pinch-to-zoom".

width - the width of the viewport.

All of the attributes require integer values, NOT floating point values.

In other words, 1 and not 1.0. Or you could use percentage.

There is no point in setting min and max scaling attributes to the same value. Also, initial-scale is known to cause problems in iOS if set to 1.

I tried the below one. It works perfectly for me.

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

我喜欢:

<meta name="viewport" content="width=device-width, initial-scale=1"/>
<meta name="viewport" content="width=321; user-scalable=no;" />

Android只接受大于320的视口宽度,所以在321上设置它对我来说是个窍门。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM