ibeautiful
如果您有想要以同样的方式过渡几个特定的属性(因为你也有你特别一些属性并不想转型,比方说opacity),另一种选择是做这样的事情(略去了前缀):.myclass { transition: all 200ms ease; transition-property: box-shadow, height, width, background, font-size;}第二个声明会覆盖其all上方的简短声明中的,并(有时)使代码更简洁。/* prefixes omitted for brevity */.box { height: 100px; width: 100px; background: red; box-shadow: red 0 0 5px 1px; transition: all 500ms ease; /*note: not transitioning width */ transition-property: height, background, box-shadow;}.box:hover { height: 50px; width: 50px; box-shadow: blue 0 0 10px 3px; background: blue;}
Hover box for demo