CSS3:背景颜色过渡到透明

Ara*_*oca 2 html css html5 dom css3

我想做一个过渡div:

  • 以..开始 background-color:rgba(242, 245, 169, 1);

    ...... 3秒后......

  • 以..结束 background-color:rgba(242, 245, 169, 0);

而且......两个fases节目之间background-color:rgba(242, 245, 169, 0.9);,background-color:rgba(242, 245, 169, 0,8);,background-color:rgba(242, 245, 169, 0.7);...

此解决方案类似,但没有':hover'.直.

我怎么才能得到它?

谢谢.

Bra*_*roy 9

http://jsfiddle.net/BramVanroy/hakomq5L/

div {
    width: 100px;
    height: 100px;
    animation: fade 3s forwards;
    background-color:rgba(242, 245, 169, 1);
}

@keyframes fade {
    from {background-color:rgba(242, 245, 169, 1);}
    to {background-color:rgba(242, 245, 169, 0);}
}
Run Code Online (Sandbox Code Playgroud)