Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cost of putting CSS Transitions on all elements

I often find myself adding transitions to a lot of things, and often they are the same transition. What would be the performance cost of just doing something like

* { 
   transition: all 200ms ease; //with prefixes, of course
}

and just setting a transition-property: none; to elements you specifically didn't want transitioning? Would it be less than the amount of code required to add multiple transition statements throughout your code?

EDIT: For those wondering about the complexity of the DOM this applied to, assume it is a complex web-app-type DOM. The reason I ask is because many elements on the page don't move and thus don't require the transition. I am curious as to whether or not that is relevant and merely assigning transitions to all elements is detrimental to performance.

like image 915
Jason Avatar asked Feb 23 '13 00:02

Jason


1 Answers

When they are not transitioning they are not consuming extra resources, so after rendering it's the same, assuming you have removed all the unnecessary transitions.

like image 64
ecc Avatar answered Nov 15 '22 08:11

ecc