Home >Web Front-end >CSS Tutorial >How Can I Create Smooth Fade-In Text Animations on Page Load Using CSS, jQuery, or Both?
The Problem: Enhancing website aesthetics by creating a text paragraph that fades in smoothly as the page loads.
Solution:
#test p { opacity: 0; margin-top: 25px; font-size: 21px; text-align: center; animation: fadein 2s; animation-fill-mode: forwards; } @keyframes fadein { from { opacity: 0; } to { opacity: 1; } }
$("#test p").addClass("load");
#test p { opacity: 0; margin-top: 25px; font-size: 21px; text-align: center; transition: opacity 2s ease-in; } #test p.load { opacity: 1; }
$("#test p").delay(1000).animate({ opacity: 1 }, 700);
Browser Compatibility:
Choose the method that best aligns with your browser support requirements and desired level of animation customization.
The above is the detailed content of How Can I Create Smooth Fade-In Text Animations on Page Load Using CSS, jQuery, or Both?. For more information, please follow other related articles on the PHP Chinese website!