HTML CSS examples for CSS Animatable Property:max-width
In the following code the max-width property of the div box is animating from its initial value "none" to "150px", and back to the initial value "none" again up to infinite times. The max-width property overrides the width property of the element.
-webkit- prefix is for Chrome, Safari, Opera.
-moz- prefix is for Firefox.
<!DOCTYPE html> <html lang="en"> <head> <title>Example of CSS max-width Property Animation</title> <style type="text/css"> .animated {<!-- www.j a v a 2s . com--> width: 500px; 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% {max-width: 150px;} } @keyframes test { 50% {max-width: 150px;} } </style> </head> <body> <p> </p> <div class="animated"> Box </div> </body> </html>