In the world of web design, adding subtle yet eye-catching animations to your website can significantly enhance the user experience. One such animation effect is making an image slide in from the left as it gracefully fades in. If you’re using the Divi theme, you’re in luck! Divi makes it easy to apply custom CSS animations to your site elements, including images.
In this article, we’ll guide you through the process of implementing a slide-in and fade-in animation for an image using CSS. This animation will not only capture your visitors’ attention but also add a touch of professionalism to your website.
To create this animation, you’ll need to define keyframes and apply them to your target image using CSS. Here’s the step-by-step breakdown:
Define the Keyframes:
To get started, open the “Custom CSS” section of Divi Theme Options. In this section, you can add custom CSS rules to style your website elements. Here’s an example of CSS code to define the keyframes for the animation:
1 2 3 4 5 6 7 8 9 10 11 12 13 |
/* Define the keyframes for the animation */ @keyframes slideInFromLeft { 0% { opacity: 0; transform: translateX(-100%); } 100% { opacity: 1; transform: translateX(0); } } |
Apply the Animation:
Once you’ve defined the keyframes, you can apply the animation to the target image. In this example, we’ll apply it to an element with the id="logo"
:
1 2 3 4 5 6 |
/* Apply the animation to the 'logo' element */ #logo { animation: slideInFromLeft 1s ease-in-out forwards; } |
Customization:
Feel free to customize the animation duration, timing function, and other properties as needed to achieve the desired visual effect. You can also apply this animation to other elements on your Divi-powered website, making your site dynamic and engaging.
Conclusion:
Adding CSS animations to your Divi theme website can breathe life into your design and captivate your audience. In this article, we’ve demonstrated how to create a slide-in and fade-in animation for an image using custom CSS in Divi Theme Options. By following these steps and experimenting with different animations, you can enhance the user experience and make your website stand out. Happy designing!