CSS로 z-색인 속성에 애니메이션을 구현하려면 다음 코드를 실행할 수 있습니다.
예시
<!DOCTYPE html> <html> <head> <style> div { position: absolute; } #box div { background-color: orange; border: 2px solid yellow; width: 100px; height: 100px; opacity: 0.3; } div#demo { opacity: 1; background-color: coral; z-index: 1; animation: myanim 3s; } @keyframes myanim { 30% { z-index: 3; } } </style> </head> <body> <h1>CSS z-index property</h1> <div id = "box"> <div id = "demo"></div> <div style = "top:20px;left:20px;z-index:1;">One</div> <div style = "top:40px;left:40px;z-index:2;">Two</div> <div style = "top:60px;left:60px;z-index:3;">Three</div> <div style = "top:80px;left:80px;z-index:4;">Four</div> <div style = "top:100px;left:40px;z-index:5;">Five</div> <div style = "top:120px;left:60px;z-index:6;">Six</div> <div style = "top:140px;left:80px;z-index:7;">Seven</div> </div> </body> </html>