CSS3 Fade Animations

↘锁芯ラ 提交于 2019-12-04 05:50:47

问题


I am trying to combine 2 CSS3 Animations that fade in and out. Can anyone help me with this?
This is what I have so far -

jsFiddle


回答1:


Ok got your question updated my answer accordingly, the best and the least you can do it is like this

Demo

Actual Markup + Styles Required(Don't use it unless and until CSS3 animations are fully supported by all browsers)

HTML

<div class="out"><span>example</span></div>

CSS

div {
   animation:demo 7s;
   -moz-animation:demo 7s; /* Firefox */
   -webkit-animation:demo 7s; /* Safari and Chrome */
   -o-animation:demo 7s; /* Opera */
   animation:demo 7s infinite;
}

@keyframes demo {
   0% {opacity:0;}
   50% {opacity:1;}
   100% {opacity:0;}
}

@-moz-keyframes demo { /* Firefox */
   0% {opacity:0;}
   50% {opacity:1;}
   100% {opacity:0;}
}

@-webkit-keyframes demo { /* Safari and Chrome */
   0% {opacity:0;}
   50% {opacity:1;}
   100% {opacity:0;}
}

@-o-keyframes demo { /* Opera */
   0% {opacity:0;}
   50% {opacity:1;}
   100% {opacity:0;}
}


来源:https://stackoverflow.com/questions/13979438/css3-fade-animations

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