Adding smooth animations to your website is simple with CSS3’s @keyframes
property.
In this tutorial, I’ll show you how to create a clean pop in effect using CSS keyframe animation. This technique is great for buttons, modals, or any element you want to draw attention to.
Understanding the Pop In Effect
The pop in effect makes an element smoothly scale from small to full size while fading in. It gives your UI a subtle animation that feels polished without being distracting.
With CSS keyframes, you define what happens at different stages of the animation, such as 0% (the start) and 100% (the end).
Step-by-Step Implementation
Here’s the base animation code:
@keyframes pop-in {
0% {
opacity: 0;
transform: scale(0.1);
}
100% {
opacity: 1;
transform: scale(1);
}
}
Apply it to any element with a class:
.pop-in-element {
animation: pop-in 0.5s ease-out;
}
How to Use
- Add the class
pop-in-element
to your HTML element. - Adjust the duration (
0.5s
) to make the effect faster or slower. - Change the easing function (
ease-out
,linear
,ease-in-out
) to experiment with the feel.
Customization Ideas
You can make the pop in animation more unique by combining properties like this:
@keyframes pop-in-bounce {
0% { opacity: 0; transform: scale(0.1); }
60% { opacity: 1; transform: scale(1.1); }
100% { transform: scale(1); }
}
- Change Direction: Combine with
translateY()
ortranslateX()
to pop in from above or from the side. - Delay: Use
animation-delay
to stagger multiple elements for a cascading effect.
Live Demo
👉 See this pop in effect on CodePen
FAQ: Pop In Effect with CSS
What is a pop in effect in CSS?
A pop in effect is an animation where an element scales up and fades into view using CSS keyframes.
Can I add the pop in effect to multiple elements?
Yes, just apply the same class to each element, or use delays to stagger them.
Does the pop in animation work on all browsers?
Modern browsers fully support CSS keyframes. Always test across devices for best results.
Final Thoughts
The CSS pop in effect is a quick way to make your UI feel more dynamic. By tweaking duration, easing, and transforms, you can create unique effects that match your site’s style.
If you want to explore more, check out MDN’s keyframe animation guide and CSS-Tricks for deeper dives.
Have your own take on the pop in animation? Share your example in the comments!
but seems to mee, that the code from coderguy is the right way!
WOW Man, works perfectly! Thanks for that!!!
Hi coderguy,
i try your code but it doesn’t work…
Bad code.. right one:
@keyframes pop-in {
0% { opacity: 0;transform: scale(0.1); }
100% { opacity: 1;transform: scale(1); }
}
@-webkit-keyframes pop-in {
0% { opacity: 0;-webkit-transform: scale(0.1); }
100% { opacity: 1;-webkit-transform: scale(1); }
}
@-moz-keyframes pop-in {
0% { opacity: 0;-moz-transform: scale(0.1); }
100% { opacity: 1;-moz-transform: scale(1); }
}