CSS3 background image transition

前端 未结 13 2327
梦如初夏
梦如初夏 2020-11-22 07:07

I\'m trying to make a \"fade-in fade-out\" effect using the CSS transition. But I can\'t get this to work with the background image...

The CSS:



        
13条回答
  •  自闭症患者
    2020-11-22 07:50

    You can transition background-image. Use the CSS below on the img element:

    -webkit-transition: background-image 0.2s ease-in-out;
    transition: background-image 0.2s ease-in-out;
    

    This is supported natively by Chrome, Opera and Safari. Firefox hasn't implemented it yet (bugzil.la). Not sure about IE.

提交回复
热议问题