Edit This Code:
<!DOCTYPE html>
<html>
<head>
<style>
#myDIV {
    height: 200px;
    background-color: lightblue;
    -webkit-animation: mymove 5s infinite; /* Chrome, Safari, Opera */
    animation: mymove 5s infinite;
}


/* Chrome, Safari, Opera */
@-webkit-keyframes mymove {
    50% {margin: 50px;}

}

/* Standard syntax */
@keyframes mymove {
    50% {margin: 50px;}

}
</style>
</head>
<body>

<p>Gradually change the margin, from 0px to 50px and back to 0px:<p>
<div id="myDIV">
This is my DIV element.
</div>

<p>The margin property is <em>animatable</em> in CSS.</p>
<p><b>Note:</b> CSS Animations do not work in Internet Explorer 9 and earlier versions.</p>

</body>
</html>


Result:
Try it Yourself - © w3schools.com
Privacy Policy