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 –