iOS Safari Sticky input at bottom unwanted white s

2020-07-11 09:13发布

So I have an input at the bottom of my page, positioned like so:

    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 40px;

When I open the keyboard on iOS Safai, there is unwanted whitespace below the input. You can scroll up from it but it shouldn't be there.

Screenshot

The highlighting is from Safari Dev console, I've highlighted HTML, so the extra whitespace is not being caused by my HTML/CSS I think...

This does not happen on Android.

Any Help?

1条回答
在下西门庆
2楼-- · 2020-07-11 09:39

iOS safari does not respect position: fixed when the input has focus. What seems to be happening is that the element's position attribute is changed to static.

There are a couple aways around this, but the ultimate best answer for now would be to not use fixed.

Additional reading: https://medium.com/@im_rahul/safari-and-position-fixed-978122be5f29

查看更多
登录 后发表回答