why does CSS background-size: cover not work in portrait mode on iOS?

后端 未结 5 656
礼貌的吻别
礼貌的吻别 2020-12-28 09:16

I\'m trying to set up a manualy splash-image across devices. I\'m doing so by checking for orientation (touch devices) or screen width vs. sc

5条回答
  •  抹茶落季
    2020-12-28 09:48

    Ok. Here is how it's working (Thanks to @iMeMyself):

    body {
        background: url(...) no-repeat center center fixed; 
        -webkit-background-size: 100%; 
        -moz-background-size: 100%; 
        -o-background-size: 100%; 
        background-size: 100%; 
        -webkit-background-size: cover; 
        -moz-background-size: cover; 
        -o-background-size: cover; 
        background-size: cover; 
        }
    

    So first set it to 100%, then to cover. This way all browser that cannot cover get the 100% value, while the ones that can get the 100% overwritten by cover.

提交回复
热议问题