Why does this CSS hover transition fail in FireFox?

£可爱£侵袭症+ 提交于 2019-12-14 02:27:28

问题


I've posted a simple example here: http://jsfiddle.net/tkJgg/

I know FF needs to have initial values set for the transition properties. I think I have that though. Any ideas what's wrong?


回答1:


use this

-moz-transition: all 0.5s ease-in-out;

DEMO




回答2:


remove the 0 at the end :

 -moz-transition: all 0.5s ease;

or specify the s(seconds) after zero :

-moz-transition: all 0.5s ease 0s;

The syntax say :

 <single-transition> = [ none | <single-transition-property> ] || <time> || <single-transition-timing-function> || <time>

where <time> is defined here :

time

The CSS data type denotes time dimensions expressed in seconds or milliseconds. They consists of a <number> immediately followed by the unit.

and moreover :

"While unitless zero is allowed for <length>, it's invalid for all other units."




回答3:


The hover transition doesn't fails in Mozilla but sometimes because of code errors or fail loading the browser disables this property. To ignore this problem you should define the browser in the CSS transition. The following is the example that which code should be used in defining different main browsers

#mydiv a:hover{
   -moz-transition:all 0.5s ease-in-out;     /*For Mozilla Browser*/ 
   -webkit-transition:all 0.5s ease-in-out;  /*For Chrome and Safari*/
   -o-transition:all 0.5s ease-in-out;       /*For Opera Browser*/
    transition:all 0.5s ease-in-out;         /*For Other Browser*/
}


来源:https://stackoverflow.com/questions/12659285/why-does-this-css-hover-transition-fail-in-firefox

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!