Change Background-Color of div element Cross Fade in a Loop

时光毁灭记忆、已成空白 提交于 2019-12-01 10:51:06
Maria

CSS:

.fadechange {
    height:200px;
    width:100%;
    background: black;
    animation: fading 4s infinite;
   -webkit-animation: fading 4s infinite;
}

@keyframes fading {
    0%   { background: black; }
    33%  { background: red; }
    66%  { background: blue; }
    100% { background: black; }
}

@-webkit-keyframes fading {
    0%   { background: black; }
    33%  { background: red; }
    66%  { background: blue; }
    100% { background: black; }
}

According to w3schools this must work in IE(10+), Opera, Chrome, Safari and Firefox. http://www.w3schools.com/cssref/css3_pr_animation-keyframes.asp

jsfiddle

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!