fmpq.com
源代码:
点击运行
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>Fmpq教程(fmpq.com)</title> <style> #DIV1 { height: 200px; width: 200px; margin: auto; border: 1px solid black; } #DIV2 { width: 150px; height: 150px; border: 1px solid black; background-color: coral; -ms-transform: rotate(45deg); /* IE 9 */ /* Chrome, Safari, Opera */ -webkit-transform: rotate(45deg); -webkit-animation: mymove 5s infinite; /* Standard syntax */ transform: rotate(45deg); animation: mymove 5s infinite; } /* Chrome, Safari, Opera */ @-webkit-keyframes mymove { 50% {-webkit-transform-origin: 0 0 0;} } /* Standard syntax */ @keyframes mymove { 50% {transform-origin: 0 0 0;} } #DIV2original { position: absolute; width: 150px; height: 150px; border: 1px dashed grey; background-color: lightgrey; opacity: 0.5; } </style> </head> <body> <p>逐步改变 transform-origin 从 "50% 50% 0" 到 "0 0 0":<p> <p><b>注意:</b>灰色 DIV 元素的 DIV2 元素不会旋转。</p> <div id="DIV1">DIV1 <div id="DIV2original">DIV2</div> <div id="DIV2">DIV2</div> </div> <p>transform-origin 属性支持动画效果。</p> <p><b>注意:</b>Internet Explorer 9 及更早 IE 版本不支持 CSS 动画。</p> </body> </html>
运行结果