JoshWComeau
A 3D clay model of a person with a dumpling for a head

Big news! Registration has just opened for
my brand-new course, Whimsical Animations(opens in new tab)! I’ll show
you how to create spectacular animations & interactions using CSS, JavaScript, SVG, and Canvas.

You can save 40% during the launch sale, but only for a limited time. You can learn all about it here:

Check it out!

Josh W Comeau homepage

Articles and Tutorials

Scroll-Driven Animations

Exploring the majestic new animation-timeline API

The new Animation Timeline API allows us to create dynamic scroll animations without any JavaScript! It’s honestly a very lovely API, and in this blog post, we’ll explore some of the super cool things we can do with it.

Read more: Scroll-Driven Animations
Squash and Stretch

The little secret that makes animations feel alive ✨

Have you ever heard of Disney’s 12 Basic Principles of Animation? In this tutorial, we’ll explore how we can use the very first principle to create SVG micro-interactions that feel way more natural and believable. It’s one of those small things that has a big impact.

Read more: Squash and Stretch
Sneaky Header Blocker Trick

There is a lil’ UI detail on this blog. Most people don’t even notice it, but the ones who do often reach out, asking how on earth it works. It feels like it defies the rules of CSS! In this blog post, I’ll break down the surprisingly-straightforward implementation so you can start using this trick yourself.

Read more: Sneaky Header Blocker Trick
Sprites on the Web

In game development, it’s common to use spritesheets for animation, but this technique isn’t as widely used on the web these days. Which is a shame, because we can do some pretty cool stuff with sprites! In this post, we’ll share the niche CSS function you can use to leverage this technique, and explore some of the potential use cases.

Read more: Sprites on the Web
Brand New Layouts with CSS Subgrid

Subgrid allows us to extend a grid template down through the DOM tree, so that deeply-nested elements can participate in the same grid layout. At first glance, I thought this would be a helpful convenience, but it turns out that it’s so much more. Subgrid unlocks exciting new layout possibilities, stuff we couldn’t do until now. ✨

Read more: Brand New Layouts with CSS Subgrid
Springs and Bounces in Native CSS

The magic of the linear() timing function

The “linear()” timing function is a game-changer; it allows us to model physics-based motion right in vanilla CSS! That said, there are some limitations and quirks to be aware of. I’ve been experimenting with this API for a while now, and in this post, I’ll share all of the tips and tricks I’ve learned for using it effectively. ✨

Read more: Springs and Bounces in Native CSS
Color Shifting in CSS

An Exploration of Color Animation Techniques

A little while ago, I was trying to animate an element’s background color, so that it cycled through the rainbow. Seems easy, but it turns out, browsers have a surprisingly big limitation when it comes to color processing! In this tutorial, we’ll dig into the issue, and I’ll share a couple of strategies you can use to work around this limitation.

Read more: Color Shifting in CSS
A Friendly Introduction to SVG

SVGs are one of the most remarkable technologies we have access to on the web. They’re first-class citizens, fully addressable with CSS and JavaScript. In this tutorial, I’ll cover all of the most important fundamentals, and show you some of the ridiculously-cool things we can do with this massively underrated tool. ✨

Read more: A Friendly Introduction to SVG
Partial Keyframes

Creating dynamic, composable CSS keyframe animations

CSS Keyframe animations are so much more powerful than most developers realize. In this tutorial, I’ll show you something that completely blew my mind, a technique that makes our keyframe animations so much more reusable and dynamic! 🤯

Read more: Partial Keyframes
The Height Enigma

Unraveling the mystery of percentage-based heights in CSS

One of the most perplexing and befuddling things in CSS for me, for many years, was the behaviour of percentage-based heights. Sometimes, seemingly at random, setting height: 100% would have no effect at all. When I finally figured out what was going on, it was like a puzzle piece snapping into place; everything made so much more sense! In this post, I’ll share the epiphany I had, and we’ll explore some solutions.

Read more: The Height Enigma

Browse By Category

Popular Content

  1. An Interactive Guide to Flexbox
  2. A Modern CSS Reset
  3. An Interactive Guide to CSS Transitions
  4. How To Center a Div
  5. The End of Front-End Development
  6. An Interactive Guide to CSS Grid
  7. Designing Beautiful Shadows in CSS
  8. Making Sense of React Server Components
  9. Why React Re-Renders
  10. CSS Variables for React Devs