如何将CSS3过渡应用于除background-position之外的所有属性? [英] How do I apply CSS3 transition to all properties except background-position?

查看:279
本文介绍了如何将CSS3过渡应用于除background-position之外的所有属性?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想对除background-position之外的所有属性应用CSS转换。
我试图这样做:

  .csstransitions a {
-webkit-transition:all 0.3s缓解;
-moz-transition:all 0.3s ease;
-o-transition:all 0.3s ease;
-ms-transition:all 0.3s ease;
transition:all 0.3s ease;
}

.csstransitions a {
-webkit-transition:background-position 0s ease 0s;
-moz-transition:background-position 0s ease 0s;
-o-transition:background-position 0s ease 0s;
-ms-transition:background-position 0s ease 0s;
transition:background-position 0s ease 0s;
}

首先我将所有属性设置为transition,然后我试图覆盖transition对于background-position属性。



但是,这似乎也会重置所有其他属性 - 所以基本上没有任何转换似乎发生了。

$ b

解决方案

这里有一个解决方案,也适用于Firefox:

  transition:全部0.3s ease,background-position 1ms; 

我做了一个小演示: http://jsfiddle.net/aWzwh/


I'd like to apply a CSS transition to all properties apart from background-position. I tried to do it this way:

.csstransitions a {
    -webkit-transition: all 0.3s ease;                  
    -moz-transition: all 0.3s ease;                 
    -o-transition: all 0.3s ease;   
    -ms-transition: all 0.3s ease;          
    transition: all 0.3s ease;
}

.csstransitions a {
    -webkit-transition: background-position 0s ease 0s;                 
    -moz-transition: background-position 0s ease 0s;                
    -o-transition: background-position 0s ease 0s;  
    -ms-transition: background-position 0s ease 0s;         
    transition: background-position 0s ease 0s;
}

First I set all properties to transition and then I tried to overwrite solely the transition for the background-position property.

However this seems to also reset all other properties - so basically none of the transitions seem to happen any more.

Is there a way to do this without listing all properties?

解决方案

Here's a solution that also works on Firefox:

transition: all 0.3s ease, background-position 1ms;

I made a small demo: http://jsfiddle.net/aWzwh/

这篇关于如何将CSS3过渡应用于除background-position之外的所有属性?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆