in

Gradient Animation Trick

You can’t animate gradient colors in CSS. No, really. There are a lot of animatable properties, but the one used for gradients, background-image, is not on the list.

Fortunately, if you were looking to animate a simple light-to-dark gradient fade, then there’s a decent workaround. Use background-size to stretch your gradient to be taller than the element it’s on. Now you can animate background-position to slide the visible portion of your gradient up and down. The end result is an element with a smoothly animated gradient background that gets lighter and darker.

And here’s a demo. Hover over the gray box to see the animation.

Check out this Pen!
Via codersblock.blogspot.com

Written by Fribly Editorial

Fribly is a digital magazine where we will share useful and awesome stuff for your inspiration and benefit.
We will hope to bring you daily resources and inspiration from all around the web. You just sit back and enjoy, and we will do all the search work for you. We will strive to find the best and most useful stuff out there.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

GIPHY App Key not set. Please check settings

Sea Icon Set

How to Create a Vintage, Camping Lantern Icon in Adobe Illustrator