When I click on a button, I want a div to rotate, just as I would do with a CSS3 transition: rotate(350deg);. How would I do this with either CSS or JS? (If it can be done with CSS I’d perfer that instead)
When I click on a button, I want a div to rotate, just as
Share
In the
onclickevent of the button, put:document.getElementById("yourDivId").className += " rotate";In the CSS:
You’d have to add the browser specfic prefixes (-moz-, -webkit-) to the transition and transform, but this should work for you.