CSS transitions are a great way to add subtle animations to your website, improving the user experience and adding a touch of interactivity. Below are 12 CSS transition effects you can easily implement in your projects.
1. Fade In
Copy code
.fade-in {
opacity: 0;
transition: opacity 0.5s ease-in;
}
.fade-in:hover {
opacity: 1;
}
2. Slide Up
Copy code
.slide-up {
transform: translateY(100%);
transition: transform 0.5s ease-in-out;
}
.slide-up:hover {
transform: translateY(0);
}
3. Scale Up
Copy code
.scale-up {
transform: scale(1);
transition: transform 0.5s ease-in-out;
}
.scale-up:hover {
transform: scale(1.2);
}
4. Rotate
Copy code
.rotate {
transform: rotate(0deg);
transition: transform 0.5s ease-in-out;
}
.rotate:hover {
transform: rotate(45deg);
}
5. Skew
Copy code
.skew {
transform: skewX(0deg);
transition: transform 0.5s ease;
}
.skew:hover {
transform: skewX(20deg);
}
6. Grow Width
Copy code
.grow-width {
width: 100px;
transition: width 0.5s ease-in-out;
}
.grow-width:hover {
width: 200px;
}
7. Background Color Change
Copy code
.bg-color-change {
background-color: #3498db;
transition: background-color 0.5s ease;
}
.bg-color-change:hover {
background-color: #2ecc71;
}
8. Text Color Change
Copy code
.text-color-change {
color: #000;
transition: color 0.3s ease;
}
.text-color-change:hover {
color: #e74c3c;
}
9. Border Radius Change
Copy code
.border-radius-change {
border-radius: 0;
transition: border-radius 0.5s ease;
}
.border-radius-change:hover {
border-radius: 50%;
}
10. Box Shadow
Copy code
.box-shadow {
box-shadow: none;
transition: box-shadow 0.3s ease-in-out;
}
.box-shadow:hover {
box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3);
}
11. Text Shadow
Copy code
.text-shadow {
text-shadow: none;
transition: text-shadow 0.3s ease;
}
.text-shadow:hover {
text-shadow: 2px 2px 5px rgba(0, 0, 0, 0.5);
}
12. Opacity Change
Copy code
.opacity-change {
opacity: 1;
transition: opacity 0.5s ease-in-out;
}
.opacity-change:hover {
opacity: 0.5;
}
Conclusion
Adding CSS transitions can greatly enhance the user interface of your website. Experiment with these effects to create a more engaging and interactive experience for your users.
Part | Title | Link |
---|---|---|
1 | Capturing Attention with Motion UI CSS Animations ✨- : Fade In/Out, Slide In/Out, and Scale Up Effects 🫠 | Read |
2 | Capturing Attention with Motion UI CSS Animations 🎨- : Bounce Animation, Parallax Scrolling, and Hover Animations 🫠 | Read |
Happy coding!
Shop Link : https://buymeacoffee.com/pratik1110r/extras
LinkedIn : https://www.linkedin.com/in/pratik-tamhane-583023217/
Behance : https://www.behance.net/pratiktamhane
Top comments (12)
Awesome post, Pratik! These simple yet effective CSS transitions are perfect for anyone looking to enhance their website's user experience with smooth animations. Thanks for breaking it down so clearly—definitely going to try these out! 🙌
Thank you so much❤️
great! simple css transitions. love the whole nature of it.!
Thank you
I wish most tutorials were like this. Kudos!
Saved for later
Thank you so much! I'm glad you found it helpful.🚀
Are all the CSS selectors compatible with modern and older browser versions?
The CSS selectors and properties used in the examples are widely supported by modern browsers, including Chrome, Firefox, Safari, Edge, and Opera. Here's a quick breakdown:
transition, transform, opacity, and box-shadow: These properties are well-supported across all modern browsers. They also work in older versions of most browsers (IE10+), although Internet Explorer may require vendor prefixes (like -ms-, -webkit-) in some cases.
Older browsers: If you need to support very old browsers (like IE9 and below), consider using fallback styles or polyfills for specific properties. For example, you might need to use filter: alpha(opacity=50) for opacity in older IE versions.
For most cases, the effects should work smoothly in modern browsers, but if you're targeting legacy browsers, it's always a good idea to test and apply necessary prefixes.
Can be great and encourage sharing more. Support you.
Thank you so much✨
nice
Thank you so much✨