Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

CSS CSS Transitions and Transforms Transition Timing Functions and Delays Change a Transition's Speed with Timing Functions

JavaScript vs CSS

Hi Community,

I have a question of what is the prefer solution to create transitions. I have noticed image galleries effects can be achieved similarly with JavaScript and CSS. But is there some sort of technology preference for this? My question is most toward response efficiency, SEO affectation if any and user experience.

Thanks

1 Answer

Michael Hulet
Michael Hulet
47,913 Points

It's always best to use CSS animations and transitions if you can. This is for 3 main reasons:

  1. CSS transitions and animations are GPU accelerated, so they'll run visibly faster and smoother than JavaScript transitions and animations
  2. A user can turn off JavaScript, and they won't see your animation/transition if they do
  3. You have to write more platform-dependent code in JavaScript than CSS

Thanks really appreciated it !

peichunliu
peichunliu
33,154 Points

Thank you for the answer. Really helpful.