0

Is it possible to rotate div with css constantly? how can i do it?

for example:

div {
   width:100px;
   height:100px;
   border: 1px solid red;
}

1 Answers1

2

using CSS3 @keyframes Rule

//html
 <div class="rotating"></div>



//css

div {
width:100px;
height:100px;
border: 1px solid red;
}

@-webkit-keyframes rotating {
    from{
    -webkit-transform: rotate(0deg);
    }
    to{
    -webkit-transform: rotate(360deg);
    }
}

.rotating {
    -webkit-animation: rotating 2s linear infinite;
}

here is the example http://codepen.io/anon/pen/GopMeq

Chun Pin Chen
  • 433
  • 1
  • 3
  • 11