# CSS Confetti

- Link: https://cagrimmett.com/2018/01/05/css-confetti/
- Published: 2018-01-05T22:46:00-05:00
- Author: Chuck Grimmett

TIL how to make confetti with CSS. No javascript needed.

I used [this codepen](https://codepen.io/fionnachan/pen/EvaqOB) as a base and modified
it to my needs. The author, [@fionnachan](https://codepen.io/fionnachan/), had an
interesting method I hadn’t thought of: Make a div for each piece of confetti, transform
and skew each one, and then set a random offset so it looks like each one moves 
independently when you apply keyframes animation. `@for` in SCSS makes the random
offsets and transforms a breeze.

The only downside is that it compiles to almost 4000 lines of CSS. I’m going to 
try a JS version and see how it performs in comparison.

UPDATE January 7, 2018: I moved to a JS solution based on [https://codepen.io/anon/pen/JMOQzE](https://codepen.io/anon/pen/JMOQzE).
50 lines of code + a jQuery dependency that was already getting loaded anyway is
much better than 4000 lines of CSS, even if the CSS is novel.

![CSS Confetti](https://i0.wp.com/cagrimmett.com/wp-content/uploads/2020/09/confetti.
png?ssl=1)

## Comments

### By: Why blog?

- Link: https://cagrimmett.com/thoughts/2022/04/26/why-blog/
- Published: 2022-05-09T15:13:18-04:00

This Article was mentioned on [cagrimmett.com](https://cagrimmett.com/thoughts/2022/04/26/why-blog/)

Loading...
