Well, the most DRY way is to use something like SASS and write mixin, and then use that instead of copying pasting this code everywhere. Another suggestion that I will make is to avoid using all , and instead list the properties that you want to animate using a linear transition. Although this may be more verbose, I bet it will be more productive, especially if you've ever put graphically demanding things like box-shadow in an element's style.
So, while your path will work, I feel like the more unique transitions, the more valuable this formulation:
element { transition-duration: 2s; transition-property: all, background, transform; transition-timing-function: linear, cubic-bezier(0.4, 0.25, 0.14, 1.5), cubic-bezier(0.4, 0.25, 0.14, 1.5); }
Of course, I recommended listing properties to avoid costly and unsolicited animations. In this case, something like this makes sense:
element { transition-duration: 2s; transition-property: height, background, transform, width; transition-timing-function: linear, cubic-bezier(0.4, 0.25, 0.14, 1.5), cubic-bezier(0.4, 0.25, 0.14,1.5), linear; }
Edit: as @BoltClock mentioned, I was mistaken in everything under this bold, so please ignore it. The arguments, separated by commas, are again applied to the order they originally set - neither the first nor the last repetition for additional transition-property values. I still think that I said that I am not using all is important advice for performance and future validation though!
Notice how I ordered the arguments: if transition-property more transition-timing-function more than arguments, all additional properties will default to the first value specified for transition-property . So, first set the value to linear (the default), then list all your unique synchronization functions so that they match the correct property, and then any properties that you change to the end (e.g. width ) will automatically be linear by default! Thus, even if you add 5 more properties to the end of the property list, only background and transform will have their own unique cubic-bezier synchronization functions. For instance:
element { transition-duration: 2s; transition-property: height, background, transform, width, oneProp, twoProp, threeProp, etcProp; transition-timing-function: linear, cubic-bezier(0.4, 0.25, 0.14, 1.5), cubic-bezier(0.4, 0.25, 0.14,1.5); }
All of the above uses the linear time function, except for background and transform . I feel this is a good compromise between performance and DRY CSS. I made jsFiddle for you to check various options - comment on different CSS to try each way:
http://jsfiddle.net/530cumas/4/