Redrawing elements ignores user-scalable=0 in Android Browser. Why?

拜拜、爱过 提交于 2019-12-04 17:46:33

Well... after 3 days of frustration I finally find out what's causing this, and I can't say I'm very happy. Mostly, because the problem was the deletion of one line.

I started deleting everything piece meal until the problem went away. I found out when I deleted normalize.css that I no longer got zoom in issues after orientation change.

This piece of CSS in normalize.css caused the issue in Android Browser.

a:active,
a:hover {
     outline: 0;
}

Removing outline: 0 also fixed zoom problem. Giving the property of 0 to outline is not one of the allowable values per the W3C (http://www.w3.org/wiki/CSS/Properties/outline-style).

The only allowable values are none dotted dashed solid double groove ridge inset outset inherit. Although 0 may evaluate the same as none, for whatever reason it breaks zooming.

Recap

If anyone else ever stumbles here trying to figure out why their Android browser appears to be re-enabling user-scalable=0 to user-scalable=1, these are the reasons why:

  1. You have some sort of CSS issue in defining your <div> elements - try playing around with position: fixed / absolute / relative until it is fixed.
  2. You are experiecing hte same problem described in this post. Using normalize.css with outline: 0

I hope this helps save someone 3 days of their life.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!