DEV Community

Cover image for 12 Simple and Effective CSS Transition Effects for Your Website🫠
Pratik Tamhane
Pratik Tamhane

Posted on • Edited on

12 Simple and Effective CSS Transition Effects for Your Website🫠

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;
}
Enter fullscreen mode Exit fullscreen mode

2. Slide Up

Copy code

.slide-up {
    transform: translateY(100%);
    transition: transform 0.5s ease-in-out;
}
.slide-up:hover {
    transform: translateY(0);
}
Enter fullscreen mode Exit fullscreen mode

3. Scale Up

Copy code

.scale-up {
    transform: scale(1);
    transition: transform 0.5s ease-in-out;
}
.scale-up:hover {
    transform: scale(1.2);
}
Enter fullscreen mode Exit fullscreen mode

4. Rotate

Copy code

.rotate {
    transform: rotate(0deg);
    transition: transform 0.5s ease-in-out;
}
.rotate:hover {
    transform: rotate(45deg);
}
Enter fullscreen mode Exit fullscreen mode

5. Skew

Copy code

.skew {
    transform: skewX(0deg);
    transition: transform 0.5s ease;
}
.skew:hover {
    transform: skewX(20deg);
}
Enter fullscreen mode Exit fullscreen mode

6. Grow Width

Copy code

.grow-width {
    width: 100px;
    transition: width 0.5s ease-in-out;
}
.grow-width:hover {
    width: 200px;
}
Enter fullscreen mode Exit fullscreen mode

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;
}
Enter fullscreen mode Exit fullscreen mode

8. Text Color Change

Copy code

.text-color-change {
    color: #000;
    transition: color 0.3s ease;
}
.text-color-change:hover {
    color: #e74c3c;
}
Enter fullscreen mode Exit fullscreen mode

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%;
}
Enter fullscreen mode Exit fullscreen mode

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);
}
Enter fullscreen mode Exit fullscreen mode

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);
}
Enter fullscreen mode Exit fullscreen mode

12. Opacity Change

Copy code

.opacity-change {
    opacity: 1;
    transition: opacity 0.5s ease-in-out;
}
.opacity-change:hover {
    opacity: 0.5;
}
Enter fullscreen mode Exit fullscreen mode

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)

Collapse
 
vkinsane profile image
Vishal Khandate

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! 🙌

Collapse
 
uicraft_by_pratik profile image
Pratik Tamhane

Thank you so much❤️

Collapse
 
roshan_khan_28 profile image
roshan khan

great! simple css transitions. love the whole nature of it.!

Collapse
 
uicraft_by_pratik profile image
Pratik Tamhane

Thank you

Collapse
 
martinbaun profile image
Martin Baun

I wish most tutorials were like this. Kudos!
Saved for later

Collapse
 
uicraft_by_pratik profile image
Pratik Tamhane

Thank you so much! I'm glad you found it helpful.🚀

Collapse
 
george_clooney_4688d1dfae profile image
george clooney

Are all the CSS selectors compatible with modern and older browser versions?

Collapse
 
uicraft_by_pratik profile image
Pratik Tamhane

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.

Collapse
 
zaneryan profile image
IndieDevr

Can be great and encourage sharing more. Support you.

Collapse
 
uicraft_by_pratik profile image
Pratik Tamhane

Thank you so much✨

Collapse
 
nithin_sukumar_a7b315399d profile image
Nithin Sukumar

nice

Collapse
 
uicraft_by_pratik profile image
Pratik Tamhane

Thank you so much✨