android autofit mode causing issues with css width in web page

前端 未结 13 1524
挽巷
挽巷 2020-12-13 10:49

I am having problems with the auto resize feature of the android browser. The widths on my site are going a bit haywire when the device is in portrait mode.

What I w

相关标签:
13条回答
  • 2020-12-13 11:27

    I have been experiencing this problem and found a solution that works for me.

    I have one main <div> with some nested <div> elements inside. The HTML is very basic. I found that one <div> within my main <div> would wrap its text as if I had double-tapped the text to zoom in on it. This <div> only contained text. This behavior occurred only in portrait orientation, and it corrected after double-tapping or switching orientation.

    Since this problem is an Android bug, no CSS or HTML can really fix it. However, the following CSS resolved the problem satisfactorily for me; and I didn't have to turn off "Auto-fit pages":

    I added a CSS background-image to the <div>. I just used a transparent, one-pixel PNG as the background.

    div { background-image: url(../img/blank.png); }

    0 讨论(0)
提交回复
热议问题