margin-bottom - HTML CSS CSS Animatable Property

HTML CSS examples for CSS Animatable Property:margin-bottom

Introduction

In the following code the margin-bottom property of the div box is animating from its initial value "0" to "100px", and back to the initial value "0" again up to infinite times.

-webkit- prefix is for Chrome, Safari, Opera.

-moz- prefix is for Firefox.

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html lang="en">
 <head>
  <title>Example of CSS margin-bottom Property Animation</title>
  <style type="text/css">
.animated {<!--from  ww  w .j  a v a  2  s.c  o  m-->
  padding: 40px 0;
  font: bold 50px sans-serif;
  text-align: center;
    background: #EEEEEE;
    border: 1px solid red;
    -webkit-animation: test 4s infinite; 
    animation: test 4s infinite;
}

@-webkit-keyframes test {
    50% {margin-bottom: 100px;}
}

@keyframes test {
    50% {margin-bottom: 100px;}
}
</style>
 </head>
 <body>
  <div class="animated">
   Box
  </div>

  <p>   </p>
 </body>
</html>

Related Tutorials