Your animation rule overwrites translateY(-50%) with scale() , and when the animation is complete, the previous rule is applied again, so it skips.
If you add translateY(-50%) to the animation, it will work fine.
A side note based on the fact that it puts translateY() before or after scale() , it animates differently, as transform values ββare applied from right to left
body, html { height: 100%; background: #c9edff; text-align: center; } .element { position: relative; top: 50%; transform: translateY(-50%); font-family: arial; font-size: 20px; line-height: 1.8em; -webkit-animation-name: zoom; -webkit-animation-duration: 0.6s; animation-name: zoom; animation-duration: 0.6s; } @-webkit-keyframes zoom { from { -webkit-transform: translateY(-50%) scale(0); } to { -webkit-transform: translateY(-50%) scale(1); } } @keyframes zoom { from { transform: translateY(-50%) scale(0); } to { transform: translateY(-50%) scale(1); } }
<div class="element"> Vertical Align is Awesome! <br /> But with animation its giving a jerk!<br/> Please Fix </div>
source share