Fade In And Fade Out Animation Css Code Example


Example 1: css fade in


/* Just add .fade-in class to element */

.fade-in {
animation: fadeIn 2s;
opacity: 1;
}

@keyframes fadeIn {
from {
opacity: 0;
}
to {
opacity: 1;
}
}

Example 2: animation fade in css


#test p {
margin-top: 25px;
font-size: 21px;
text-align: center;

-webkit-animation: fadein 2s; /* Safari, Chrome and Opera > 12.1 */
-moz-animation: fadein 2s; /* Firefox < 16 */
-ms-animation: fadein 2s; /* Internet Explorer */
-o-animation: fadein 2s; /* Opera < 12.1 */
animation: fadein 2s;
}

@keyframes fadein {
from { opacity: 0; }
to { opacity: 1; }
}

/* Firefox < 16 */
@-moz-keyframes fadein {
from { opacity: 0; }
to { opacity: 1; }
}

/* Safari, Chrome and Opera > 12.1 */
@-webkit-keyframes fadein {
from { opacity: 0; }
to { opacity: 1; }
}

/* Internet Explorer */
@-ms-keyframes fadein {
from { opacity: 0; }
to { opacity: 1; }
}

/* Opera < 12.1 */
@-o-keyframes fadein {
from { opacity: 0; }
to { opacity: 1; }
}

Example 3: css fade out


/* Answer to: "css fade out" */

/*
With the code below, all you have to do is use JavaScript to
give the element ".hide-opacity" and it'll fade-out.

Feel free to edit this code so it works on hover, focus, active
or any other special selector possible with CSS and of course
feel free to use this code with your JavaScript too!
*/


.successfully-saved {
color: #FFFFFF;
text-align: center;

-webkit-transition: opacity 3s ease-in-out;
-moz-transition: opacity 3s ease-in-out;
-ms-transition: opacity 3s ease-in-out;
-o-transition: opacity 3s ease-in-out;
opacity: 1;
}

.successfully-saved.hide-opacity {
opacity: 0;
}

Comments

Popular posts from this blog

Converting A String To Int In Groovy

"Cannot Create Cache Directory /home//.composer/cache/repo/https---packagist.org/, Or Directory Is Not Writable. Proceeding Without Cache"

Android How Can I Convert A String To A Editable