In Internet Explorer this animation appears to wobble. I was reading the answer to this question and they made it sound as though it is possible to fix.
I cannot really use an image as the border radius is not constant, and I would prefer not to use an animated gif.
I understand 'wobble' is not a very good description but I can't think of any other words to describe it. I have not tested it with Opera/Safari, so if you have either of them I would like to know if they display correctly or also have the problem. Please run the following Snippet in Chrome/Firefox and compare it to the Snippet in Internet Explorer:
@keyframes spin{
0% {transform:rotateZ(0deg);}
50% {transform:rotateZ(360deg);border-radius:60%;}
100%{transform:rotateZ(720deg);}
}
@-webkit-keyframes spin{
0% {transform:rotateZ(0deg);}
50% {transform:rotateZ(360deg);border-radius:60%;}
100%{transform:rotateZ(720deg);}
}
@-moz-keyframes spin{
0% {transform:rotateZ(0deg);}
50% {transform:rotateZ(360deg);border-radius:60%;}
100%{transform:rotateZ(720deg);}
}
@-ms-keyframes spin{
0% {transform:rotateZ(0deg);}
50% {transform:rotateZ(360deg);border-radius:60%;}
100%{transform:rotateZ(720deg);}
}
@-o-keyframes spin{
0% {transform:rotateZ(0deg);}
50% {transform:rotateZ(360deg);border-radius:60%;}
100%{transform:rotateZ(720deg);}
}
#spinme{
display:inline-block;
position:relative;
left:0;
top:0;
margin:0.2rem;
width:0.8rem;
height:0.8rem;
border:0.2rem solid black;
border-radius:0;
outline: 1px solid transparent; /* require to remove jagged edges in firefox */
transform:rotateZ(0deg);
animation: spin infinite 4s;
-webkit-animation: spin infinite 4s;
-moz-animation: spin infinite 4s;
-ms-animation: spin infinite 4s;
-o-animation: spin infinite 4s;
}
#spinme:nth-child(2){animation-delay:0.06s}
#spinme:nth-child(3){animation-delay:0.12s}
#spinme:nth-child(4){animation-delay:0.18s}
<div id="spinme"></div>
<div id="spinme"></div>
<div id="spinme"></div>
<div id="spinme"></div>
The outline
hack to fix the sharp edge came from this answer.
As a side question, and out of curiosity, which of those prefixes are actually required? I was looking at the compatibility requirements to get it working in older browsers, but it only ever mentions the -webkit
prefix: none of the -moz
,-ms
or -o
prefixes seem to be needed for any browser version.
I have also just checked shouldiprefix and they seem to agree with caniuse, but given how similar the names are I thought that the same community/company may run both websites. Should I just remove the other prefixes?