272 of 313 menu

The animation-duration property

The animation-duration property sets an animation duration.

Syntax

selector { animation-duration: duration in s or ms; }

Values

Value Description
s Specifies a time in seconds (e.g. 3s).
ms Specifies a time in milliseconds (e.g. 3ms). One second is 1000 milliseconds.

Default value: 0s.

Example

In this example, the animation will play for 3 seconds:

<div id="elem"></div> @keyframes move { from { margin-left: 0px; } to { margin-left: 400px; } } #elem { animation-duration: 3s; animation-name: move; animation-iteration-count: infinite; animation-timing-function: linear; border: 1px solid black; width: 50px; height: 50px; }

:

See also

uzkkmsfrru