20 Animated Backgrounds [Pure CSS]
So, here are 20 great animated backgrounds you can use in your projects, or draw inspiration from! Ideal for hero slider websites.
1) Animated Background Colours in CSS
Let's start with the basics. A simple colour fade - you can use
@keyframes to fade the background between as many colours as you need and use the percentages to determine how long the animation will stay on that colour before changing.
Simple, easy to implement, and effective.
2) CSS Animated Background Gradient
Now let's take it up a notch - instead of a single colour fading into another, you can add an extra touch of class with a gradient, pleasantly sweeping back and forth across the screen. This is one of the easiest ways to make a moving background in CSS.
3) Floating Squares
Time to add some objects into the mix! Here's a cool moving background (CSS only, believe it or not) by TokyoWeb. These semi-transparent rotating squares float up the screen.
This looks cool as-is, but the cool thing is, you can play around with the code to create different colours, shapes, directions, and speeds. Put your creative hat on and see what you come up with.
4) Fireworks CSS background effects - version 1
This pure CSS animated firework effect would look great by itself (could be cool on a "Congratulations" or "Success" page or something like that), but could look even cooler with a foreground image, maybe a cityscape.
5) Fireworks CSS background effects - version 2
Here's another approach you could take to fireworks - this version has a different feel - the particles have a more natural movement, almost as if there's a gravity to them.
6) Seeding CSS background effect
This moving background (CSS only) feels a bit like moving through a ball pool at warp speed. I like it.
7) Blurred Lines
If Robin Thicke made CSS background effects, this might be the sort of thing he came up with. This one is eye-catching without being distracting - notice that even with this quite light typeface, the text is still easy to read.
8) Retro Grid Animated CSS background
Are you a fan of the 80s retro look? Are you building a site for a synthwave artist? Or can you simply not let go of the past? If the answer to any of these questions is "Yes", then you'll love this excellent Tron-style retro grid animation!
You can change the colours with the variables
$computationalFogBot setting the background, and
$nodeStreak setting the colour of the bars.
For another example in this theme, check out this one, too:
9) Snowfall Effect Animated Background (CSS only)
I don't know whether it's the festive season at the time you're reading this. For me, it doesn't matter. I'll put my Santa hat on and watch Elf any time of year. If you feel the same, then here's a nice snowfall effect for you - with actual snowflakes!
10) Parallax Snowfall Background
What's that you say, you want even more snow? OK...How about this one then? This has much heavier snowfall, and a very nice parallax effect to boot.
11) Infinite triangles
This one plays tricks with your brain. Are the triangles moving up or down? Expanding or contracting? No one knows - that's the fun.
12) Floating Heart Infinite Animation
Much like the triangles above, here's another CSS background animation that falls squarely into the "trippy" category. With this one, not only do you get a cool background animation, but you get to open your chakras at the same time. Bonus.
13) CSS Fireflies
These little fireflies invoke a sense of wonder and intrigue. The effect looks cool with the forest background, but works really well on just a plain colour, too:
These Hypno squares are cute and pretty unique. Don't look at them too long though - they might be transmitting subliminal messages to your subconscious mind.
15) Blurry Bubbles Animation
These blurred/slightly out of focus bubbles pop into existence seemingly at random, bring delight and happiness for a short time, and then slowly but inevitably fade away. Which, incidentally, is also an accurate description of my love life - but that's a story for another time.
16) CSS Animated Lava Lamp
OK, so far you've seen some cool CSS background animation examples which you can pretty much plug-and-play. Now let's explore what's possible when you're at the top of your game - starting with this CSS-only lava lamp by Janos Szudi!
17) Matrix Effect Animated Background (CSS)
This is nice. The whole thing is actually done just through colour changes on the little square elements, creating an instantly recognisable effect.
18) Lighthouse at night CSS background animation
How about this amazing piece of work by Cameron Fitzwilliam! Now, this one does use JS... but... the JS just controls the way the image reacts to your mouse movement. You can delete all the JS and the animations on the wave and the lighthouse light will still work. So I'm allowing it.
19) Single Div Pure CSS Book Search
This is a really nice and cute CSS animation by the awesome Lynn Fisher. But check out the HTML box in the editor. No, don't adjust your monitor, you are seeing that right - she made this using a single div. Pure CSS doesn't get any purer than that! Or does it...
20) No Div Car CSS animation
Here abxlfazl khxrshidi has gone a step further, and made this CSS animated background of a car (one that's gonna get pulled over very soon by the looks of it!), with no
div at all!
Check for yourself, the HTML box is empty, apart from comments. How they've done it, is to apply all their CSS to the
It's pretty amazing what you can come up with when you've mastered your craft! But one of the cool things about front end web development is that we can use code snippets, libraries, and frameworks made by people much more skilled than us. That way, we don't have to wait until we reach mastery to start making really cool stuff.
One such library I recommend you check out is fullPage.js.
fullPage helps you build full page sites - where you split your webpage into chunks, each taking up the full size of the user's browser. You know the type - as you scroll, you move to the next page, rather than scrolling down just a little bit. Don't know yet what I'm talking about? Just check out these 20 examples of one-page websites and your doubts will disappear.
With fullPage you'd be able to integrate the different CSS background animations we've just looked over here, maybe putting a different one on each page. If that sounds like something that might work well on one of your projects, then check out some examples of what it can do here: fullPage.js examples.
Join 2,000+ readers and learn something new every month!