简体   繁体   English

CSS适用于Chrome,但不适用于Firefox

[英]CSS works on Chrome but not Firefox

I tried a lot of things but nothing is working, idk if its a transform/translateX thing or not. 我尝试了很多事情,但是没有任何效果,如果它不是一个transform / translateX事情,则idk。 I tried fading and it worked, but bouncing and the translateX is not working. 我尝试了淡入淡出,但效果很好,但是弹跳了,translateX无法正常工作。 I am currently using brakets software and I also tried sublime test 2. Please help. 我目前正在使用brickts软件,并且还尝试了崇高测试2。请帮助。 Thanks. 谢谢。

/*animations*/

/******************
* Bounce in right *
*******************/


.animated { 
-webkit-animation-duration: 1s; 
-moz-animation-duration: 1s; 
-webkit-animation-fill-mode: both; 
-moz-animation-fill-mode: both; 
} 
.slow{
 -webkit-animation-duration: 2s; 
-moz-animation-duration: 2s; 
-webkit-animation-fill-mode: both; 
-moz-animation-fill-mode: both; 
}
.slower{
 -webkit-animation-duration: 3s; 
-moz-animation-duration: 3s; 
-webkit-animation-fill-mode: both; 
-moz-animation-fill-mode: both; 
}
.slowest{
 -webkit-animation-duration: 4s; 
-moz-animation-duration: 4s; 
-webkit-animation-fill-mode: both; 
-moz-animation-fill-mode: both; 
}

.bounceInRight, .bounceInLeft, .bounceInUp, .bounceInDown{
opacity:0;
-webkit-transform: translateX(100px);
-moz-transform: translateX(100px); 
}
.fadeInRight, .fadeInLeft, .fadeInUp, .fadeInDown{
opacity:0;
-webkit-transform: translateX(400px); 
-moz-transform: translateX(400px); 
}

.flipInX, .flipInY, .rotateIn, .rotateInUpLeft, .rotateInUpRight,
 .rotateInDownLeft, .rotateDownUpRight, .rollIn{
opacity:0;
}

.lightSpeedInRight, .lightSpeedInLeft{
opacity:0;
-webkit-transform: translateX(400px); 
-moz-transform: translateX(400px); 
}

/***********
* bounceIn *
************/
@-webkit-keyframes bounceIn { 
0% { 
    opacity: 0; 
    -webkit-transform: scale(.3); 
} 

50% { 
    opacity: 1; 
    -webkit-transform: scale(1.05); 
} 

70% { 
    -webkit-transform: scale(.9); 
} 

100% { 
     -webkit-transform: scale(1); 
} 
} 

@-moz-keyframes bounceIn { 
0% { 
    opacity: 0; 
    -moz-transform: scale(.3); 
} 

50% { 
    opacity: 1; 
    -moz-transform: scale(1.05); 
} 

70% { 
-moz-    transform: scale(.9); 
} 

100% { 
    -moz-transform: scale(1); 
} 
} 

.bounceIn.go { 
-webkit-animation-name: bounceIn; 
-moz-animation-name: bounceIn; 
}

/****************
* bounceInRight *
****************/

@-webkit-keyframes bounceInRight { 
0% { 
    opacity: 0; 

    -webkit-transform: translateX(100px); 
} 
30%{
    -webkit-transform: translateX(100px)
}
60% { 

    -webkit-transform: translateX(-10px); 
} 
80% { 
    -webkit-transform: translateX(5px); 
} 
100% {
opacity: 1;

    -webkit-transform: translateX(0); 
} 
} 

@-moz-keyframes bounceInRight { 
0% { 
    opacity: 1; 

 -moz-   transform: translateX(100px); 
} 
30%{
-moz-    transform: translateX(100px)
}

60% { 

    -moz-transform: translateX(-10px); 
} 
80% { 
    -moz-transform: translateX(5px); 
} 
100% {
opacity: 1;

    -moz-transform: translateX(0); 
} 
} 


.bounceInRight.go { 
-webkit-animation-name: bounceInRight; 
-moz-animation-name: bounceInRight; 
}

You need the unprefixed properties. 您需要无前缀的属性。

So for example: 因此,例如:

.animated { 
-webkit-animation-duration: 1s; 
-moz-animation-duration: 1s; 
animation-duration: 1s; // unprefixed
-webkit-animation-fill-mode: both; 
-moz-animation-fill-mode: both; 
animation-duration: 1s; // unprefixed
} 

Thank you for your help. 谢谢您的帮助。 I have found the answer. 我找到了答案。 My html code had something wrong which was: style='display:inline , it works on chrome but for Firefox and Safari you should use this: style='display:inline-block . 我的html代码出错了: style='display:inline ,它可以在chrome上使用,但是对于Firefox和Safari,您应该使用以下代码: style='display:inline-block Thanks again. 再次感谢。

At first, check your syntax. 首先,检查您的语法。 I have noticed that there are some "broken" properties, written '-moz- transform'. 我注意到有一些“损坏的”属性,写为“ -moz-transform”。 It should be one word. 应该是一个字。 Second, could you provide some HTML or a jsfiddle? 其次,您可以提供一些HTML还是jsfiddle?

(I could not post it as a comment - not enough reputation to do that.) (我无法将其发布为评论-没有足够的声誉来做到这一点。)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM