Quickly add CSS Fade in animations

Our original post on fancy fade in animations on page load  got really popular so we decided to create a really quick and dirty way to add Fading animations to your site.
 In essence this is very similar to our original tutorial, however this one comes already with built in fadeInLeft, fadeInRight, fadeInDown and fadeInUp animations. We borrowed these classes from animate.css framework so all credit goes to Daniel Eden. You can download the full animate.css from his site which comes with a boat load of animations that you will probably never use. So why add another css file to your project when you can just add the ones that are used the most.

Don’t have time to read? Just skip and add this css to yours and you can start using it right out of the box.

See the Pen QjZjPG by Alex (@fabriceleven) .

How it works

We have a trigger that needs to be added anytime animation is to be used. We set it to be animate and it looks like this

Then we have delay, for example:  (you can modify it to be whatever you want)

And finally the rest is just the animation itself. It consists of @keyframe that tells what’s changing and how, as well as the keyframe pointer.

That’s all you need to create these animations! So your html might look like this:

First class is just to style our object, second is the trigger, then animation name followed by an optional delay.

Final CSS you can just copy and paste to yours

The below css has the following animations: fadeIn, fadeInDown, fadeInUp, fadeInLeft and fadeInRight . Just add this CSS to the bottom of yours and you can start using them just like in our example. More run down how this works and creating custom animations is in our original tutorial.

The only limitation of this is that it only animates once. So if you have a lot of these on a page and some below the fold, even though you have added a delay they might get executed before user actually sees them. The solution is to have these animations come in as user scrolls all you need is include 1 small js file and you are set (you can still use the above tags you just will use a different trigger word other than animate, see our tutorial

Let us know how you are using this! Again remember to not overdo it, fadeIn and fadeInUp look the best (you can see it on our about us page as you scroll).