CSS3 Tricks: Falling Snow Animation with CSS only

Blog, Tutorials No Comments

CSS3 animations brought a whole new level of possibilities into the CSS world. So inspired by the current development in Game of Thrones (winter is finally here) I decided that in today’s tutorial, I will show you how to create a simple falling snow animation with CSS only. We made snow animations before, both in Flash and Javascript. We even created a simple WordPress plugin that adds the snowing effect to your website but it’s great to see that it’s possible to make it with CSS3 only. I already made a falling leaves animation with CSS3 only and since it’s very popular I decided to make a falling snow also.


Download Falling Snow Source Files (144)


We add one instance of the snowflake with the <span></span> tag. If you wish to add more snowflakes simply multiply this tag. Now create a file called style.css and add the design for the class created above:

Add the snowflake here as a background for each instance of the span that we defined earlier. Size and the initial position of the flakes are set here. Webkit animation is actually pretty simple. We set which class to animate (fallingSnow) and set the falling time to 12 seconds. We want the animation to continuously repeat itself so we will set it to infinite. Eeasing is set to cubic-bezier to achieve a somewhat random falling effect. I chose this easing over linear in this case so the falling of the snowflakes feels more realistic. You can create your own cubic-bezier easing with the help of this great tool where you can set the curve, check the animation and just copy the settings to your style.css.


Before we get to the animation itself we have to somehow randomize the snowflakes so they don’t all start falling at the same time. I used the nth-child method to define several sequences of flakes with different animation delays.

These are just three examples, I added several more sequences in the live example provided above. Download the source files to see them all. The first sequence is set to 5n+5 which means flakes number 5, 10, 15,… will start falling with the delay of 1 second. The second sequence is set to 3n + 2 which means flakes 2,5, 8, 11,… will start falling with the delay of 1.5 seconds. Note that some sequences may overlap with each other but it’s not a big deal, the CSS will always take the last setting and use it for the animation.


All we have to add now is the animation effect. It is actually pretty simple. Add the following code to your style.css file:

As you can see we divided our animation into three parts (state at 0%, at 75% and at 100%). The animation starts with x and y coordinates set to 0px and rotation along Z axis also set to 0. This is the initial position of the animation. After the animation starts it will start moving towards position set in the second part (75%). Flakes will move slightly to the right (x coordinate is set to 100px) and down (y coordinate is set to 600px). It will also rotate for 3/4 of the full circle (270deg). Snowflakes will still be fully visible (opacity is set to 1). Opacity is the reason why we added the second part of animation anyway. It allows us to slowly fade the flakes to invisible after they reach a certain point. When flakes reach the ending point (100%) they are instantly moved back up where they start animating again. And we are done. The implementation is pretty simple and straightforward and you get a decent falling snow effect in no time. And it’s extremely light weight with no extra resources used.


CSS3 animations can be very powerful and diverse and even animation of multiple objects is a piece of cake. Please note that these animations are only supported in Webkit browsers (Chrome, Opera). In our future tips&tricks posts, I will show you how to make gradients, apply animations to images and much more so stay tuned! Winter is still far away but when it comes you will be ready to give your website an extra kick in December with your brand new falling snow animation.

Download Falling Snow Source Files (144)

Image Credit

Credit for the beautiful winter image used in the example goes to DreamyPixel.

CSS Falling Snow Animation

We really appreciate you for visiting PremiumCoding and reading this article! Now you might also want to check out our Themes here.
Written by PremiumCoding
We develop beautiful Wordpress themes with minimal and clean design.