Show Output
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>Example of CSS3 opacity Property Animation</title> <style> .container{ width: 300px; height: 200px; position: relative; background: #db75d6; border: 5px solid #a0299a; } .animated { opacity: 0; width: 200px; padding: 75px 0; margin: 50px; font: bold 46px sans-serif; background: #6f5ece; outline: 5px solid #4936b4; text-align: center; -webkit-animation: test 4s infinite; /* Chrome, Safari, Opera */ animation: test 4s infinite; } /* Chrome, Safari, Opera */ @-webkit-keyframes test { 50% {opacity: 1;} } /* Standard syntax */ @keyframes test { 50% {opacity: 1;} } </style> </head> <body> <p><strong>Warning:</strong> CSS Animations do not work in Internet Explorer 9 and earlier versions.</p> <p><strong>Note:</strong> The opacity (i.e. transparency) of the blue DIV box is animating from its initial value "0" to "1", and back to the initial value "0" again up to infinite times.<p> <div class="container"> <div class="animated">Box</div> </div> </body> </html>