animation-duration

  • Revision slug: Web/CSS/animation-duration
  • Revision title: animation-duration
  • Revision id: 493411
  • Created:
  • Creator: kscarfone
  • Is current revision? Yes
  • Comment Updated tags

Revision Content

{{ CSSRef() }}
{{ SeeCompatTable() }}

Summary

The animation-duration CSS property specifies the length of time that an animation should take to complete one cycle.

A value of 0s, which is the default value, indicates that no animation should occur.

It is often convenient to use the shorthand property {{ cssxref("animation") }} to set all animation properties at once.

{{cssbox("animation-duration")}}

Syntax

Formal syntax: {{csssyntax("animation-duration")}}
animation-duration: 6s
animation-duration: 120ms
animation-duration: 1s, 15s
animation-duration: 10s, 30s, 230ms

Values

<time>
The duration that an animation should take to complete one cycle. This may be specified in either seconds (by specifying s as the unit) or milliseconds (by specifying ms as the unit). If you don't specify a unit, the declaration will be invalid.
Note: Negative values are invalid, causing the declaration to be ignored. Note that some early, prefixed, implementations may consider them as identical to 0s.

Examples

See CSS animations for examples.

Specifications

Specification Status Comment
{{ SpecName('CSS3 Animations', '#animation-duration', 'animation-duration') }} {{ Spec2('CSS3 Animations') }}  

Browser compatibility

{{ CompatibilityTable() }}

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari (WebKit)
Basic support 3.0{{ property_prefix("-webkit") }} {{ CompatGeckoDesktop("5.0") }}{{ property_prefix("-moz") }}
{{ CompatGeckoDesktop("16.0") }}
10 12{{ property_prefix("-o") }}
12.10 #
4.0{{ property_prefix("-webkit") }}
Feature Android Firefox Mobile (Gecko) IE Phone Opera Mobile Safari Mobile
Basic support 2.0{{ property_prefix("-webkit") }} {{ CompatGeckoMobile("5.0") }}{{ property_prefix("-moz") }}
{{ CompatGeckoMobile("16.0") }}
{{ CompatNo() }} {{ CompatNo() }} 4.2{{ property_prefix("-webkit") }}

See also

  • Using CSS animations
  • {{ domxref("AnimationEvent", "AnimationEvent") }}
  • {{ CSS_Reference:animation() }}

Revision Source

<div>
 {{ CSSRef() }}</div>
<div>
 {{ SeeCompatTable() }}</div>
<h2 id="Summary">Summary</h2>
<p>The <code>animation-duration</code> CSS property specifies the length of time that an animation should take to complete one cycle.</p>
<p>A value of <code>0s</code>, which is the default value, indicates that no animation should occur.</p>
<p>It is often convenient to use the shorthand property {{ cssxref("animation") }} to set all animation properties at once.</p>
<p>{{cssbox("animation-duration")}}</p>
<h2 id="Syntax">Syntax</h2>
<pre class="twopartsyntaxbox">
<a href="/en-US/docs/CSS/Value_definition_syntax" title="/en-US/docs/CSS/Value_definition_syntax">Formal syntax</a>: {{csssyntax("animation-duration")}}
</pre>
<pre>
animation-duration: 6s
animation-duration: 120ms
animation-duration: 1s, 15s
animation-duration: 10s, 30s, 230ms
</pre>
<h3 id="Values">Values</h3>
<dl>
 <dt>
  <code>&lt;time&gt;</code></dt>
 <dd>
  The duration that an animation should take to complete one cycle. This may be specified in either seconds (by specifying <code>s</code> as the unit) or milliseconds (by specifying <code>ms</code> as the unit). If you don't specify a unit, the declaration will be invalid.</dd>
</dl>
<div class="note">
 <strong>Note:</strong> Negative values are invalid, causing the declaration to be ignored. Note that some early, prefixed, implementations may consider them as identical to <code>0s</code>.</div>
<h2 id="Examples">Examples</h2>
<p>See <a href="/en/CSS/CSS_animations" title="en/CSS/CSS_animations">CSS animations</a> for examples.</p>
<h2 id="Specifications" name="Specifications">Specifications</h2>
<table class="standard-table">
 <thead>
  <tr>
   <th scope="col">Specification</th>
   <th scope="col">Status</th>
   <th scope="col">Comment</th>
  </tr>
 </thead>
 <tbody>
  <tr>
   <td>{{ SpecName('CSS3 Animations', '#animation-duration', 'animation-duration') }}</td>
   <td>{{ Spec2('CSS3 Animations') }}</td>
   <td>&nbsp;</td>
  </tr>
 </tbody>
</table>
<h2 id="Browser_Compatibility" name="Browser_Compatibility">Browser compatibility</h2>
<p style="margin-left: ;">{{ CompatibilityTable() }}</p>
<div id="compat-desktop">
 <table class="compat-table">
  <tbody>
   <tr>
    <th>Feature</th>
    <th>Chrome</th>
    <th>Firefox (Gecko)</th>
    <th>Internet Explorer</th>
    <th>Opera</th>
    <th>Safari (WebKit)</th>
   </tr>
   <tr>
    <td>Basic support</td>
    <td>3.0{{ property_prefix("-webkit") }}</td>
    <td>{{ CompatGeckoDesktop("5.0") }}{{ property_prefix("-moz") }}<br />
     {{ CompatGeckoDesktop("16.0") }}</td>
    <td>10</td>
    <td>12{{ property_prefix("-o") }}<br />
     12.10 <a href="http://my.opera.com/ODIN/blog/2012/08/03/a-hot-opera-12-50-summer-time-snapshot" title="http://my.opera.com/ODIN/blog/2012/08/03/a-hot-opera-12-50-summer-time-snapshot">#</a></td>
    <td>4.0{{ property_prefix("-webkit") }}</td>
   </tr>
  </tbody>
 </table>
</div>
<div id="compat-mobile">
 <table class="compat-table">
  <tbody>
   <tr>
    <th>Feature</th>
    <th>Android</th>
    <th>Firefox Mobile (Gecko)</th>
    <th>IE Phone</th>
    <th>Opera Mobile</th>
    <th>Safari Mobile</th>
   </tr>
   <tr>
    <td>Basic support</td>
    <td>2.0{{ property_prefix("-webkit") }}</td>
    <td>{{ CompatGeckoMobile("5.0") }}{{ property_prefix("-moz") }}<br />
     {{ CompatGeckoMobile("16.0") }}</td>
    <td>{{ CompatNo() }}</td>
    <td>{{ CompatNo() }}</td>
    <td>4.2{{ property_prefix("-webkit") }}</td>
   </tr>
  </tbody>
 </table>
</div>
<h2 id="See_also">See also</h2>
<ul>
 <li><a href="/en-US/docs/CSS/Tutorials/Using_CSS_animations" title="Tutorial about CSS animations">Using CSS animations</a></li>
 <li>{{ domxref("AnimationEvent", "AnimationEvent") }}</li>
 <li>{{ CSS_Reference:animation() }}</li>
</ul>
Revert to this revision