*{ margin:0; padding:0;} .bigdiv{ width:100px; height:100px; top:50%; left:50%; margin-top:-50px; margin-left:-50px;position:absolute;} .yuan{ width:80px; height:80px; background:#666; position:absolute; margin:auto; left:0; top:0; right:0; bottom:0} .yuan:hover{animation:hehe 3s ease infinite;-webkit-animation:hehe 3s ease infinite;} @keyframes hehe { 0% {margin-top:0px; margin-left:0} 50% {margin-top:10px; margin-left:10px} 100% {margin-top:0px; margin-left:0} } @-webkit-keyframes hehe { 0% {rotate(0deg); } 100% {rotate(360deg); } }