CSS background stretches to fill height in iOS but there is white space on scroll

前端 未结 7 1594
暗喜
暗喜 2021-02-06 18:57

this CSS gets my background to fill 100% of the screen height in iOS but there is a minor problem - when you scroll down there is initially white space, then when you release yo

7条回答
  •  北恋
    北恋 (楼主)
    2021-02-06 19:27

    I have just solved this issue. The problem for me was that the whitespace was showing when I had my body tag with a background-image, with the background-size set to cover. To fix this issue I set:

    background-size: 100vw 100vh;

    Then set the media query I was having the problem with to

    {background-size: cover;}
    

提交回复
热议问题