Reputation: 1059
-webkit-transition: width 0.4s, height 0.4s;
-moz-transition: width 0.4s, height 0.4s;
-o-transition: width 0.4s, height 0.4s;
transition: width 0.4s, height 0.4s;
This effects the size of a div element when it is animated/moved, but I also have a requirement to adjust the opacity of it as well:
-webkit-transition: opacity 0.4s ease-out;
-moz-transition: opacity 0.4s ease-in;
-o-transition: opacity 0.4s ease-in;
transition: opacity 0.4s ease-in;
Do these go one after another in my style sheet or is there a way for me to combine them into one? Is there a best practice?
Upvotes: 0
Views: 96
Reputation: 125641
Just use a comma to separate the properties in order to combine them (like you yourself did in the first example)
-webkit-transition: width 0.4s, height 0.4s,opacity 0.4s ease-in;
transition: width 0.4s, height 0.4s,opacity 0.4s ease-in;
Value: none |
<single-transition-property> [ ‘,’
<single-transition-property> ]*
Which shows that multiple properties may be transitioned when separated by a comma.
Upvotes: 2