How to display an element in the middle of CSS3 animation -


in example, want display element in step of animation. however, not possible, because if set display:none in main css rule, animation not override it.

#test {     -webkit-animation: test 2s;     display:none; // here problem, animation not override it. }  @-webkit-keyframes test {     0%{margin:5px}     20%{display:block}     70%{margin:40px} } 

note simplified example, , in practice, need use display:none hide element before becomes visible animation. thus, other tricks opacity not satisfy need.

i'm not sure you're trying do, if want hide element , show when animation starts, make use of visibility property this:

#test {   -webkit-animation: test 2s;   visibility:hidden;  }  @-webkit-keyframes test {    0%{margin:5px}   20%{visibility:visible}   70%{margin:40px} } 

fiddle example


Comments

Popular posts from this blog

c++ - Function signature as a function template parameter -

algorithm - What are some ways to combine a number of (potentially incompatible) sorted sub-sets of a total set into a (partial) ordering of the total set? -

How to call a javascript function after the page loads with a chrome extension? -