search

Home  >  Q&A  >  body text

css3 - 如何为background-image设置动画?

用代码说话

    section.tt-grid-wrapper{
    &:hover{
        background-image{
            -webkit-animation: pulse 2.0s infinite ease-in-out;
            animation: pulse 2.0s infinite ease-in-out;
        }
    }   
}

想让该选区在鼠标点击时,只让背景图执行动画,这样的less写法有错,求指点!!

天蓬老师天蓬老师2783 days ago648

reply all(2)I'll reply

  • 高洛峰

    高洛峰2017-04-17 11:06:46

    Aren’t there detailed instructions in the css3 animation on w3school for animation instructions? (http://www.w3school.com.cn/css3/css3_animation.asp)
    Background execution animation? Just execute the written animation in hove....
    This is how I understand it. Demonstration: http://sandbox.runjs.cn/show/eijaxo1t
    Code: http://runjs.cn/code/eijaxo1t

    reply
    0
  • PHPz

    PHPz2017-04-17 11:06:46

    Do you want the following effect?
    http://jsfiddle.net/chenxiaochun/kgLV5/

    reply
    0
  • Cancelreply