CodeLab
Tutorials For Everyone
Run
<!DOCTYPE html> <html> <head> <style> #grid-container { display: grid; grid-template-columns: auto auto auto; background: #333; grid-gap: 20px; padding: 20px; margin: 20px; box-shadow: 0 0 10px 0 #aaa; border-radius: 20px; } #grid-container div { width: 50px; height: 50px; text-align: center; line-height: 50px; font-size: 20px; background: red; border-radius: 50px; margin: auto; } #item1 {animation: anim 5s infinite;} #item2 {animation: anim 5s infinite; animation-delay: 0.3s;} #item3 {animation: anim 5s infinite; animation-delay: 0.6s;} #item4 {animation: anim 5s infinite; animation-delay: 0.9s;} #item5 {animation: anim 5s infinite; animation-delay: 1.2s;} #item6 {animation: anim 5s infinite; animation-delay: 1.5s;} #item7 {animation: anim 5s infinite; animation-delay: 1.8s;} #item8 {animation: anim 5s infinite; animation-delay: 2.1s;} #item9 {animation: anim 5s infinite; animation-delay: 2.4s;} @keyframes anim { 50% {opacity: 0;} } </style> </head> <body> <h1>Animatable 'opacity' Property</h1> <hr> <p>Experience the changing opacity of the grid items.</p> <div id="grid-container"> <div id="item1">1</div> <div id="item2">2</div> <div id="item3">3</div> <div id="item4">4</div> <div id="item5">5</div> <div id="item6">6</div> <div id="item7">7</div> <div id="item8">8</div> <div id="item9">9</div> </div> </body> </html>