I am trying to fade in an element after 2 sec using CSS animation. The code works great in new browsers, but in old browsers the element will stay hidden because of "opacity:0".
I want it to be visible in old browsers and I don't want to involve javascript. Can it be solved using CSS? Eg. some how target browsers that doesn't support animation?
CSS:
#element{
animation:1s ease 2s normal forwards 1 fadein;
-webkit-animation:1s ease 2s normal forwards 1 fadein;
opacity:0
}
@keyframes fadein{from{opacity:0}
to{opacity:1}
}
@-webkit-keyframes fadein{from{opacity:0}
to{opacity:1}
}
HTML:
<div id=element>som content</div>
opacity: 0
like @Michael Giovanni Pumo stated, however instead of time-stretching to merge the delay into the timeline, just applyanimation-fill-mode: backwards
to apply the delay to the first keyframe (aka the 'from' state). Note: If your ending keyframe does something unique within the animation, then you will want to useanimation-fill-mode: both
. jsfiddle.net/m3z2htLe – Tetragrammaton