Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CSS @keyframes not working in Chrome

I was experimenting CSS3 @keyframes animations but I didn't managed to make it work in Chrome (currently I have Chrome 38)

The code is really simple :

HTML

<div id="block">moving text</div>


CSS

@keyframes mymove
{
    0%   {top:0px;}
    25%  {top:200px;}
    50%  {top:100px;}
    75%  {top:200px;}
    100% {top:0px;}
}

#block {
    position:absolute;
    animation: mymove 2s infinite;
}

Here is a Fiddle with the same code.

For me the text isn't moving in Chrome 38, but it works great on Firefox 30 and IE 11.

I have tried to use @-webkit-keyframes but the text doesn't move either in Chrome.

like image 732
singe3 Avatar asked Jul 17 '14 14:07

singe3


1 Answers

You need to use the vendor prefix on both the style property, and keyframes function

Demo Fiddle

@-webkit-keyframes mymove /* <--- here */
{
    0%   {top:0px;}
    25%  {top:200px;}
    50%  {top:100px;}
    75%  {top:200px;}
    100% {top:0px;}
}

#block {
    position:absolute;
    -webkit-animation: mymove 2s infinite;/* <--- and here */
}
like image 125
SW4 Avatar answered Oct 25 '22 08:10

SW4