x
 
<!DOCTYPE html>
<html>
<head>
<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() {
  // 针对 IE9 的代码
  document.getElementById("myDIV").style.msTransform = "rotate(20deg)"; 
  // 标准语法
  document.getElementById("myDIV").style.transform = "rotate(20deg)"; 
}
</script>
<p><b>注释:</b>Internet Explorer 9 支持替代方法,即 msTransform 属性。更新版本的 IE 和 Edge 支持 transform 属性(不需要 ms 前缀)。</p>
</body>
</html>