Using CSS or JavaScript

If you've spent time using JavaScript (and more likely, jQuery), then you will know that we can use it to produce some complex animations. Achieving the same results in CSS might be a little bit of an eye-opener for some, but they may ask: which is better? If you thought CSS, then you'd be right…and wrong! Let me explain.

Conventional wisdom has always said that CSS is better—after all, JavaScript and jQuery use custom animation handlers that will repeat code between 30 and 60 times a second. This puts more pressure on a browser than a browser just running pure CSS.

However, lots of people have argued in favor of either; there are clear arguments for or against using either technology in a site. For example, in a post for ...

Get Learning Less.js now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.