04-30-2024, 06:02 PM
I'm having trouble getting a CSS fade-in effect to work on page load. I've seen it on a few websites and I'd like to implement it on my own project. The effect should make a text paragraph smoothly transition from invisible to fully visible when the page is loaded. I've set up the initial CSS to make the text element invisible and I've applied a transition rule to it aiming for that fade-in effect. However, I'm not certain how to properly trigger this transition on page load. Here's the current CSS I'm working with:
And here's the basic HTML markup:
Any advice on how to get this transition to trigger as soon as the page is done loading would be appreciated.
Code:
#test p {
opacity: 0;
margin - top: 25 px;
font - size: 21 px;
text - align: center; -
webkit - transition: opacity 2 s ease - in; -
moz - transition: opacity 2 s ease - in; -
o - transition: opacity 2 s ease - in; -
ms - transition: opacity 2 s ease - in;
transition: opacity 2 s ease - in;
}
And here's the basic HTML markup:
Code:
<div id = "test" >
<p > This is a test < /p>
</div>
Any advice on how to get this transition to trigger as soon as the page is done loading would be appreciated.