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


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

}

/* Standard syntax */
@keyframes mymove {
    50% {max-width: 600px;}

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

<p>Change the max-width, from "none" to "600px" and back to "none":<p>

<div id="myDIV">
  <p>This DIV element does not have a pre-defined width.</p>
  <p>Try resizing the browser window to see that width of this DIV element will grow/shrink along width the resizing, but it will never exceed 600 pixels in width.</p>
</div>

<p>The max-width property is <em>animatable</em> in CSS.</p>
<p><b>Note:</b> Currently the max-width property is not changing <em>gradually</em> in Chrome, and does not change at all in Firefox.</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