Reputation: 15683
In this example, I want to display the element just in a step of the animation. However, it is not possible, because if I set display:none
in the main CSS
rule, the animation will not override it.
#test {
-webkit-animation: test 2s;
display:none; // here is the problem, as the animation does not override it.
}
@-webkit-keyframes test {
0%{margin:5px}
20%{display:block}
70%{margin:40px}
}
Note that this is a simplified example, and in practice, I need to use display:none
to hide the element before it becomes visible by the animation. Thus, other tricks like opacity
does not satisfy my need.
Upvotes: 0
Views: 192
Reputation: 9654
I'm not sure what you're trying to do, if you want to hide the element and just show it when the animation starts, make use of visibility property like this:
#test {
-webkit-animation: test 2s;
visibility:hidden;
}
@-webkit-keyframes test {
0%{margin:5px}
20%{visibility:visible}
70%{margin:40px}
}
Upvotes: 1