I am trying to create a text that would fade into view after a few seconds but I am facing problems. The fade into view is working fine but the text disappears almost immediately after it is shown. Secondly I need this animation to work in a delayed manner but when I set the delay it doesn't seem to make any difference. The delay was working fine earlier.
Why does the animation disappear shortly after it is shown? What should I do to get it displayed correctly? Why is the delay not working now? Please help me. The solution must be simple but I am probably not thinking along the right line.
The below is my code.
HTML:
<div id="container" class="container">
<span class="fadeText">Sample Text</span>
</div>
CSS:
.container{
margin: 5% auto;
position: relative;
text-align: center;
}
.fadeText{
color: #5B83AD;
font-weight: bold;
font-size: 125%;
border-radius: 4px;
border: 1px solid #5B83AD;
padding: 4px;
text-align: center;
opacity: 0;
-webkit-animation-delay: 5s;
-moz-animation-delay: 5s;
animation-delay: 5s;
-webkit-animation: fadeIn 5s ease-in;
-moz-animation: fadeIn 5s ease-in;
animation: fadeIn 5s ease-in;
}
/* Animations */
@-moz-keyframes fadeIn{
0% {
opacity: 0;
}
100% {
opacity: 1;
}
}
@-webkit-keyframes fadeIn{
0% {
opacity: 0;
}
100% {
opacity: 1;
}
}
@keyframes fadeIn{
0% {
opacity: 0;
}
100% {
opacity: 1;
}
}
/* End of Animations */
Fiddle: http://jsfiddle.net/hg4Xy/
Note: I have extracted only the relevant portion of the code and posted here.