mozilla

Revision 238102 of animation-duration

  • Revision slug: CSS/animation-duration
  • Revision title: animation-duration
  • Revision id: 238102
  • Created:
  • Creator: teoli
  • Is current revision? No
  • Comment

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.

  • {{ Xref_cssinitial() }}: 0s
  • Applies to: all elements, and {{ cssxref("::before") }} and {{ cssxref("::after") }} pseudo-elements
  • {{ Xref_cssinherited() }}: no
  • Media: {{ Xref_cssvisual() }}
  • {{ Xref_csscomputed() }}: as specified

Syntax

animation-duration: <time> [, <time>]*

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, seconds are assumed.
Note: Negative values are treated as 0s.

Examples

See CSS animations for examples.

Specifications

Specification Status Comment
CSS Animations Level 3 {{ 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") }} 10 12{{ property_prefix("-o") }} 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") }} {{ CompatNo() }} {{ CompatNo() }} 4.2{{ property_prefix("-webkit") }}

See also

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

{{ languages( { "ja": "ja/CSS/animation-duration", "fr": "fr/CSS/animation-duration"} ) }}

Revision Source

<p>{{ CSSRef() }}</p>
<p>{{ SeeCompatTable() }}</p>
<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>
<ul class="cssprop">
  <li><dfn>{{ Xref_cssinitial() }}:</dfn> <code>0s</code></li>
  <li><dfn>Applies to:</dfn> all elements, and {{ cssxref("::before") }} and {{ cssxref("::after") }} <a href="/en/CSS/Pseudo-elements" title="Pseudo-elements">pseudo-elements</a></li>
  <li><dfn>{{ Xref_cssinherited() }}:</dfn> no</li>
  <li><dfn>Media:</dfn> {{ Xref_cssvisual() }}</li>
  <li><dfn>{{ Xref_csscomputed() }}:</dfn> as specified</li>
</ul>
<h2 id="Syntax">Syntax</h2>
<pre class="eval syntaxbox">animation-duration: <a href="/en/CSS/time" title="en/CSS/time">&lt;time&gt;</a> [, <a href="/en/CSS/time" title="en/CSS/time">&lt;time&gt;</a>]*
</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 "s" as the unit) or milliseconds (by specifying "ms" as the unit). If you don't specify a unit, seconds are assumed.</dd>
</dl>
<div class="note">
  <strong>Note:</strong> Negative values are treated as <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 style="background-color: rgb(255, 204, 255);">
      <th scope="col">Specification</th>
      <th scope="col">Status</th>
      <th scope="col">Comment</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><a class="external" href="http://dev.w3.org/csswg/css3-animations/#the-animation-duration-property-" title="http://dev.w3.org/csswg/css3-animations/#the-animation-duration-property-">CSS Animations Level 3</a></td>
      <td>{{ Spec2('CSS3 Animations') }}</td>
      <td> </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") }}</td>
        <td>10</td>
        <td>12{{ property_prefix("-o") }}</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") }}</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/CSS/CSS_animations" title="en/CSS/CSS_animations">CSS animations</a></li>
  <li>{{ domxref("Event/AnimationEvent", "AnimationEvent") }}</li>
  <li>{{ CSS_Reference:animation() }}</li>
</ul>
<p>{{ languages( { "ja": "ja/CSS/animation-duration", "fr": "fr/CSS/animation-duration"} ) }}</p>
Revert to this revision