How to fix vh(viewport unit) css in mobile Safari?

前端 未结 8 1813
慢半拍i
慢半拍i 2020-12-14 16:54

I\'ve used vh (viewport units) css in one of my projects but in mobile safari it doesn\'t work. It seems like Safari doesn\'t know what to do with vh, but it works fine in o

8条回答
  •  借酒劲吻你
    2020-12-14 17:25

    If you need a fullscreen div on mobile browsers, try using wrapper with fixed position and height set to 100%. Then set 100% height to your popup. You can adjust the position of the wrapper and popup in a way you like with top, left, right, bottom properties, as well as height and width.

    These eliminates the problem with mobile browsers address bar autohiding in my case where I had to create a fullscreen popup on mobile chrome.

提交回复
热议问题