background-attachment:fixed not working in chrome

后端 未结 11 2058
无人及你
无人及你 2020-12-21 19:39

I am developing a website in which I have used the background-attachment:fixed property. It\'s working fine in Firefox, but the image is not fixed. In Chrome it

11条回答
  •  没有蜡笔的小新
    2020-12-21 20:05

    nothing was working for me, and finally this did the trick with no reasoning behind :)

    -webkit-background-size: cover !important;
    -moz-background-size: cover;
    -o-background-size: cover;
    background-size: cover;
    background-attachment: fixed !important;
    position: static !important;
    z-index: -1 !important;
    

    This is working for me in both firefox and chrome. Hope that helps.

提交回复
热议问题