mozilla

Revision 467529 of animation-delay

  • Revision slug: Web/CSS/animation-delay
  • Revision title: animation-delay
  • Revision id: 467529
  • Created:
  • Creator: teoli
  • Is current revision? No
  • Comment

Revision Content

{{CSSRef}}{{SeeCompatTable}}

Summary

The animation-delay CSS property specifies when the animation should start. This lets the animation sequence begin some time after it's applied to an element.

A value of 0s, which is the default value of the property, indicates that the animation should begin as soon as it's applied. Otherwise, the value specifies an offset from the moment the animation is applied to the element; animation will begin that amount of time after being applied.

Specifying a negative value for the animation delay causes the animation to begin executing immediately. However, it will appear to have begun executing partway through its cycle. For example, if you specify -1s as the animation delay time, the animation will begin immediately but will start 1 second into the animation sequence.

If you specify a negative value for the animation delay, but the starting value is implicit, the starting value is taken from the moment the animation is applied to the element.

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

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

Syntax

Formal syntax: {{csssyntax("animation-delay")}}
animation-delay: 3s
animation-delay: 2s, 4ms

Values

<time>
The time offset from the time at which the animation is applied to the element at which the animation should begin. 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 statement is invalid.

Examples

See CSS animations for examples.

Specifications

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

Browser compatibility

{{CompatibilityTable}}
Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari (WebKit)
Basic support {{CompatVersionUnknown}}{{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 {{CompatVersionUnknown}}{{property_prefix("-webkit")}} {{CompatGeckoMobile("5.0")}}{{property_prefix("-moz")}}
{{CompatGeckoMobile("16.0")}}
{{CompatUnknown}} 12{{property_prefix("-o")}} {{CompatVersionUnknown}}{{property_prefix("-webkit")}}

See also

Revision Source

<div>
  {{CSSRef}}{{SeeCompatTable}}</div>
<h2 id="Summary">Summary</h2>
<p>The <code>animation-delay</code> <a href="/en-US/docs/CSS" title="CSS">CSS</a> property specifies when the animation should start. This lets the animation sequence begin some time after it's applied to an element.</p>
<p>A value of <code>0s</code>, which is the default value of the property, indicates that the animation should begin as soon as it's applied. Otherwise, the value specifies an offset from the moment the animation is applied to the element; animation will begin that amount of time after being applied.</p>
<p>Specifying a negative value for the animation delay causes the animation to begin executing immediately. However, it will appear to have begun executing partway through its cycle. For example, if you specify <code>-1s</code> as the animation delay time, the animation will begin immediately but will start 1 second into the animation sequence.</p>
<p>If you specify a negative value for the animation delay, but the starting value is implicit, the starting value is taken from the moment the animation is applied to the element.</p>
<p>It is often convenient to use the shorthand property {{cssxref("animation")}} to set all animation properties at once.</p>
<p>{{cssbox("animation-delay")}}</p>
<h2 id="Syntax">Syntax</h2>
<pre class="twopartsyntaxbox">
<a href="/en-US/docs/CSS/Value_definition_syntax" title="CSS/Value_definition_syntax">Formal syntax</a>: {{csssyntax("animation-delay")}}
</pre>
<pre>
animation-delay: 3s
animation-delay: 2s, 4ms
</pre>
<h3 id="Values">Values</h3>
<dl>
  <dt>
    <code>&lt;time&gt;</code></dt>
  <dd>
    The time offset from the time at which the animation is applied to the element at which the animation should begin. 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 statement is invalid.</dd>
</dl>
<h2 id="Examples">Examples</h2>
<p>See <a href="/en-US/docs/CSS/CSS_animations" title="CSS/CSS_animations">CSS animations</a> for examples.</p>
<h2 id="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-delay', 'animation-delay')}}</td>
      <td>{{Spec2('CSS3 Animations')}}</td>
      <td>&nbsp;</td>
    </tr>
  </tbody>
</table>
<h2 id="Browser_compatibility" name="Browser_compatibility">Browser compatibility</h2>
<div>
  {{CompatibilityTable}}</div>
<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>{{CompatVersionUnknown}}{{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>{{CompatVersionUnknown}}{{property_prefix("-webkit")}}</td>
        <td>{{CompatGeckoMobile("5.0")}}{{property_prefix("-moz")}}<br />
          {{CompatGeckoMobile("16.0")}}</td>
        <td>{{CompatUnknown}}</td>
        <td>12{{property_prefix("-o")}}</td>
        <td>{{CompatVersionUnknown}}{{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