CodeLab
Tutorials For Everyone
Run
<!DOCTYPE html> <html> <head> <style> #container { margin: auto; height: 150px; width: 300px; padding: 10px; background: #333; text-align: center; color: #fff; box-shadow: 0 0 10px 0 #888; } @keyframes anim { 50% { transform-origin: 0 0 0;} } #child { padding: 30px; background-color: red; white-space: pre; animation: anim 10s infinite; font-size: 20px; width: 150px; height: 20px; transform: rotate(45deg); opacity: 0.8; } #child-original { padding: 30px; background-color: blue; white-space: pre; font-size: 20px; position: absolute; width: 150px; height: 20px; } </style> </head> <body> <h1>Animatable 'transform-origin' Property</h1> <hr> <p>Experience the changing value of the transform origin property to 0,0,0.<p> <div id="container">Transform Origin Property <div id="child-original">0 1 2 3 4 5 6 7 8 9</div> <div id="child">0 1 2 3 4 5 6 7 8 9</div> </div> </body> </html>