- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Animate CSS z-index property
To implement animation on z-index property with CSS, you can try to run the following code −
Example
<!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>
Advertisements