Skip to content
Related Articles
Open in App
Not now

Related Articles

CSS | animation-duration Property

Improve Article
Save Article
  • Last Updated : 01 Aug, 2022
Improve Article
Save Article

The animation-duration property in CSS is used to define how long an animation should take to complete one cycle. That is it is used to specify the time duration for which animation will be played. 


animation-duration: time|initial|inherit;

Property Value:

  • time: This value is used to specify the length of time for which an animation will complete one cycle. This can be specified in either in seconds or in milliseconds. The default value is 0, which means that no animation will occur.
  • initial: This value is used to set the property to its default value.
  • inherit: This value is used to inherits the property from its parent element.

Example: HTML program to illustrate the animation-duration property in CSS. 


<!DOCTYPR html>
        CSS | animation-duration Property
        #gfg1 {
            animation-name: text;
            animation-duration: 5s;
            animation-iteration-count: infinite;
        #geek1 {
            font-size: 40px;
            text-align: center;
            font-weight: bold;
            color: #090;
            padding-bottom: 5px;
        #geek2 {
            font-size: 17px;
            font-weight: bold;
            text-align: center;
        @keyframes text {
            from {
                margin-top: 400px;
            to {
                margin-top: 0px;
    <!-- The below div is animated for a duration of 5s
       and will be played an infinite number of times -->
    <div id="gfg1">
        <div id="geek1">
        <div id="geek2">
            A computer science portal for geeks



Supported Browser: The browser supported by animation-duration property are listed below:

  • Google Chrome 43.0 and above
  • Edge 12.0 and above
  • Internet Explorer 10.0 and above
  • Firefox 16.0 and above
  • Opera 30.0 and above
  • Safari 9.0 and above

My Personal Notes arrow_drop_up
Related Articles

Start Your Coding Journey Now!