Create a collection of satisfying micro-interactions including animated checkboxes, loading buttons, success toasts, and hover cards. Perfect for social media sharing and learning CSS animations.
Want to see what you'll be building? Check out the working example with complete code snippets.
Preview ThisMicro-interactions are small, purposeful animations:
Create a clean, organized layout:
<div class="interaction-showcase">
<div class="interaction-item">
<h3>Animated Checkbox</h3>
<label class="checkbox-container">
<input type="checkbox" id="checkbox1">
<span class="checkmark"></span>
<span class="label-text">Accept terms & conditions</span>
</label>
</div>
<div class="interaction-item">
<h3>Loading Button</h3>
<button class="loading-btn" id="loadingBtn">
<span class="btn-text">Click to Load</span>
<span class="spinner"></span>
</button>
</div>
</div>
Create smooth state transitions:
.checkmark {
width: 28px;
height: 28px;
border: 3px solid rgba(255, 255, 255, 0.8);
border-radius: 6px;
position: relative;
transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
background: transparent;
display: flex;
align-items: center;
justify-content: center;
}
.checkbox-container input:checked + .checkmark {
background: linear-gradient(135deg, #4CAF50, #45a049);
border-color: #4CAF50;
transform: scale(1.1) rotate(5deg);
box-shadow: 0 5px 15px rgba(76, 175, 80, 0.4);
}
Build interactive loading states:
.loading-btn.loading .btn-text {
opacity: 0;
transform: translateY(-10px);
}
.loading-btn.loading .spinner {
display: inline-block;
animation: spin 0.8s linear infinite;
}
@keyframes spin {
0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); }
}
Add smooth entrance and exit animations:
.toast {
animation: toastSlideIn 0.5s ease-out;
}
@keyframes toastSlideIn {
0% { transform: translateX(-100%); opacity: 0; }
100% { transform: translateX(0); opacity: 1; }
}
@keyframes toastSlideOut {
0% { transform: translateX(0); opacity: 1; }
100% { transform: translateX(100%); opacity: 0; }
}
Create responsive mouse-tracking effects:
.card-glow {
background: radial-gradient(circle at var(--mouse-x, 50%) var(--mouse-y, 50%),
rgba(255, 255, 255, 0.1) 0%,
transparent 50%);
opacity: 0;
transition: opacity 0.3s ease;
}
.hover-card:hover .card-glow {
opacity: 1;
}
Build robust interaction systems:
Ensure smooth 60fps animations:
transform
and opacity
: These properties are optimizedbox-shadow
changes: They can cause performance issueswill-change
strategically: Only for elements being animatedrequestAnimationFrame
: For complex animationsMake interactions work for everyone:
prefers-reduced-motion
Micro-interactions work in all modern browsers:
Once you’ve mastered micro-interactions, try:
Ready to add delight to your interfaces? Let’s build some amazing micro-interactions! ✨