padding-top - HTML CSS CSS Animatable Property

HTML CSS examples for CSS Animatable Property:padding-top

Introduction

In the following code the padding-top property of the following paragraph element is animating from its initial value "10px" to "100px", and back to the initial value "10px" 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 padding-top Property Animation</title>
  <style type="text/css">
.animated {<!--from w ww  .j  a v a 2 s  .co  m-->
  padding: 10px;
    background: #ecb3c6;
    border: 1px solid #d24875;
    -webkit-animation: test 4s infinite; 
    animation: test 4s infinite;
}

@-webkit-keyframes test {
    50% {padding-top: 100px;}
}

@keyframes test {
    50% {padding-top: 100px;}
}
</style>
 </head>
 <body>

  <p> </p>
  <p class="animated">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam eu sem tempor, varius quam at, luctus dui. Mauris magna metus, dapibus nec turpis vel, semper malesuada ante. Vestibulum id metus ac nisl bibendum scelerisque non non purus. Suspendisse varius nibh non aliquet sagittis. In tincidunt orci sit amet elementum vestibulum. Vivamus fermentum in arcu in aliquam. Quisque aliquam porta odio in fringilla. Vivamus nisl leo, blandit at bibendum eu, tristique eget risus. Integer aliquet quam ut elit suscipit, id interdum neque porttitor. Integer faucibus ligula.</p>
 </body>
</html>

Related Tutorials