0
我的p标记中的文本与Google Chrome上的@keyframes动画一起使用,但不适用于Firefox和/或IE。我正在运行最新版本的Firefox,但无法弄清楚它为什么不起作用。帮助将不胜感激。 p标签内的文本应该从浏览器窗口的左侧移动到中间。再次,它在Chrome中运行得很好,但在Firefox和IE中是静态的。@keyframes无法在Firefox或IE中使用。仅在Chrome上
h.h1 p {
margin-top: 25px;
font-size: 21px;
text-align: center;
animation-name: fromleft;
animation-duration: 2s;
animation-timing-function: ease;
-moz-animation-name: fromleft;
-moz-animation-duration: 2s;
-moz-animation-timing-function: ease;
-webkit-animation-name: fromleft; /* Safari, Chrome and Opera > 12.1 */
-webkit-animation-duration: 2s;
-webkit-animation-timing-function: ease;
-ms-animation-name: fromleft;
-ms-animation-duration: 2s;
-ms-animation-timing-function: ease;
}
@keyframes fromleft {
0% { margin-left: -5000px; }
50% { margin-left: 0px; }
100% { margin-left: auto ; margin-right: auto; }
}
/* Safari, Chrome and Opera > 12.1 */
@-webkit-keyframes fromleft {
0% { margin-left: -5000px; }
50% { margin-left: 0px; }
100% { margin-left: auto ; margin-right: auto; }
/* Internet Explorer */
@-ms-keyframes fromleft {
0% { margin-left: -5000px; }
50% { margin-left: 0px; }
100% { margin-left: auto ; margin-right: auto; }
}
/* Opera < 12.1 */
@-o-keyframes fromleft {
0% { margin-left: -5000px; }
50% { margin-left: 0px; }
100% { margin-left: auto ; margin-right: auto; }
}
/* Firefox < 16 */
@-moz-keyframes fromleft {
0% { margin-left: -5000px; }
50% { margin-left: 0px; }
100% { margin-left: auto ; margin-right: auto; }
这里是我的CSS
<div class="h1">
<h1> Some Text </h1>
<div>
<p> Some Text </P>
</div>
</div>
这样做。我根据您的意见更改了代码,并且可以在IE,Chrome和Firefox中使用。很高兴知道“汽车”。我多了一些代码,并删除了所有前缀,-m0z,-o,-ms,-webkit等,并且代码仍可在所有3种浏览器上使用。这些前缀是否仅用于和/或需要,以便代码可以在这些浏览器的旧版本上工作? – BrownBag24
查看http://caniuse.com/#feat=css-animation –