fmpq.com
源代码:
点击运行
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>Fmpq教程(fmpq.com)</title> <style> #myDIV{ margin:auto; border:1px solid black; width:200px; height:100px; background-color:coral; color:white; } </style> </head> <body> <p>点击“尝试一下”按钮,旋转 DIV 元素:</p> <button onclick="myFunction()">尝试一下</button> <div id="myDIV"> <h1>myDIV</h1> </div> <script> function myFunction(){ document.getElementById("myDIV").style.transform = "rotate(20deg)"; /* Opera、Chrome 和 Safari */ document.getElementById("myDIV").style.WebkitTransform = "rotate(20deg)"; /* IE 9 */ document.getElementById("myDIV").style.msTransform = "rotate(20deg)"; } </script> </body> </html>
运行结果