Source Code:
(back to article)
Submit
Result:
Report an issue
<!DOCTYPE html> <html> <head> <title>Title of the document</title> <style> body { background-color: #eeeeee; font-size: 1.1em; font-family: 'Roboto', Helvetica, sans-serif; } .container { margin: 10px auto; max-width: 700px; } .wrap { width: 150px; height: 150px; border: 2px solid #666666; display: inline-block; margin: 100px; } .box { width: 150px; height: 150px; position: relative; color: #eeeeee; text-align: center; line-height: 150px; -webkit-transform: rotate(25deg); transform: rotate(25deg); } .a { background-color: #0747af; } .b { background-color: #40b530; -webkit-transform-origin: top left; transform-origin: top left; } .c { background-color: #666666; -webkit-transform-origin: 90% 120%; transform-origin: 90% 120%; } .d { background-color: #ffdb11; -webkit-transform-origin: 80px 40px; transform-origin: 80px 40px; } </style> </head> <body> <h2>Transform-origin property example</h2> <div class="container"> <div class="wrap"> <div class="box a"> 50% 50% </div> </div> <div class="wrap"> <div class="box b"> top left </div> </div> <div class="wrap"> <div class="box c"> 90% 120% </div> </div> <div class="wrap"> <div class="box d"> 80px 40px </div> </div> </div> </body> </html>