Command Palette

Search for a command to run...

Micro-Animations CSS Library

A tiny CSS file with 15 subtle hover and click animations for buttons and links.

SnippetsJuly 2024


Features

  • 15 animations
  • Zero JS
  • Hardware accelerated

Drop this 2KB CSS file into any project and instantly add satisfying, smooth micro-interactions to your UI elements using simple class names.

What’s Inside

This isn't a bloated framework. It's a single, lightweight CSS file containing 15 distinct micro-interactions, each optimized for performance and visual appeal.

  • Button States: Enhancements for hover, focus, and active states that feel responsive and alive.
  • Link Interactions: Subtle animations that reward clicks and hovers without being distracting.
  • Hardware Acceleration: All animations run on the GPU (via transform and opacity), ensuring smooth performance even on low-end devices.
  • Zero Dependencies: No JavaScript required. Just copy-paste the CSS and add the utility classes.

Getting Started

Integrating the animation library is straightforward:

1. Include the CSS

Add the following <link> tag to the <head> of your HTML document:

<link rel="stylesheet" href="/css/micro-animations.css">

2. Apply the Classes

Use the provided utility classes on your interactive elements. Here are some examples:

Buttons

<!-- Soft Bounce -->
<button class="anim-btn-soft-bounce">Click Me</button>

<!-- Glow Effect -->
<button class="anim-btn-glow">Submit</button>

<!-- Slide In -->
<button class="anim-btn-slide-in">Register</button>

Links

<!-- Underline Draw -->
<a href="#" class="anim-link-underline-draw">Learn More</a>

<!-- Fade In -->
<a href="#" class="anim-link-fade-in">View Details</a>

Animation List

Class NameTriggerDescriptionDurationTiming
anim-btn-soft-bounceHover/ActiveGentle bounce effect0.3sease-out
anim-btn-glowHoverSoft outer glow expansion0.4sease-in-out
anim-btn-slide-inHoverSlides in slightly on hover0.2sease-out
anim-btn-pulseHoverPulsing shadow effect0.6sease-in-out
anim-btn-shrinkClickBriefly shrinks on press0.15sease-out
anim-btn-popHoverPops out slightly0.3sease-out
anim-btn-scale-upHoverGentle scaling0.2sease-out
anim-link-underline-drawHoverUnderline draws itself0.3sease-out
anim-link-fade-inHoverText fades in0.2sease-in-out
anim-link-pop-outHoverLink pops out0.25sease-out
anim-link-slide-inHoverLink slides in0.2sease-out
anim-hover-liftHoverLifts element slightly0.3sease-out
anim-hover-zoomHoverZooms in slightly0.3sease-out
anim-hover-shadowHoverAdds shadow on hover0.3sease-out
anim-hover-borderHoverBorder grows on hover0.3sease-out

Customization

To customize the animations, simply edit the micro-animations.css file. You can adjust:

  • animation-duration: Change the speed of the animations.
  • animation-timing-function: Switch between different easing functions (e.g., linear, ease-in, ease-out, ease-in-out).
  • box-shadow / transform: Modify the visual properties of the animations.