mozilla

Revision 22246 of animation-delay

  • Revision slug: CSS/animation-delay
  • Revision title: animation-delay
  • Revision id: 22246
  • Created:
  • Creator: teoli
  • Is current revision? No
  • Comment 18 words added, 6 words removed

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 0, 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.

<style type="text/css"></style>
  • {{ Xref_cssinitial() }}: 0
  • Applies to: all elements, and {{ cssxref("::before") }} and {{ cssxref("::after") }} pseudo-elements
  • {{ Xref_cssinherited() }}: no
  • Media: {{ Xref_cssvisual() }}
  • {{ Xref_csscomputed() }}: as specified

Syntax

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

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, seconds are assumed.

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 {{ CompatVersionUnknown() }}{{ property_prefix("-webkit") }} {{ CompatGeckoDesktop("5.0") }}{{ property_prefix("-moz") }} 10 {{ property_prefix("-ms") }} 12{{ property_prefix("-o") }} 4.0{{ property_prefix("-webkit") }}
Feature Android Firefox Mobile (Gecko) IE Phone Opera Mobile Safari Mobile
Basic support {{ CompatUnknown() }} {{ CompatUnknown() }} {{ CompatUnknown() }} {{ CompatUnknown() }} {{ CompatUnknown() }}

See also

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

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

Revision Source

<p>{{ CSSRef() }}</p>
<p>{{ SeeCompatTable() }}</p>
<h2>Summary</h2>
<p>The <code>animation-delay</code> <a href="/en/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>0</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>
<nobr>
<style type="text/css"><![CDATA[.cssprop {
  display:table;
  padding: 0.4em;
  border-left:0.15em solid;
  background-color:#eeeeff
}
.cssprop li {
 display:table-row;
 padding: 3px;
 margin:0;
}
.cssprop li dfn {
  display:table-cell;
  padding: 0 5px;
  border-bottom: none;
  cursor:inherit;
}

]]></style>
<ul class="cssprop"> <li>{{ Xref_cssinitial() }}: <code>0</code></li> <li>Applies to: all elements, and {{ cssxref("::before") }} and {{ cssxref("::after") }} <a href="/en/CSS/Pseudo-elements" title="Pseudo-elements">pseudo-elements</a></li> <li>{{ Xref_cssinherited() }}: no</li> <li>Media: {{ Xref_cssvisual() }}</li> <li>{{ Xref_csscomputed() }}: as specified</li>
</ul>
</nobr><h2>Syntax</h2>
<pre class="eval syntaxbox">animation-delay: <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>
<h2>Values</h2>
<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 "s" as the unit) or milliseconds (by specifying "ms" as the unit). If you don't specify a unit, seconds are assumed.</dd>
</dl>
<h2>Examples</h2>
<p>See <a href="/en/CSS/CSS_animations" title="en/CSS/CSS_animations">CSS animations</a> for examples.</p>
<h2>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-delay-property-" title="http://dev.w3.org/csswg/css3-animations/#the-animation-delay-property-">CSS Animations Level 3</a></td> <td>{{ Spec2('CSS3 Animations') }}</td> <td> </td> </tr> </tbody>
</table>
<h2 name="Browser_Compatibility">Browser compatibility</h2>
<p>{{ 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>{{ CompatVersionUnknown() }}{{ property_prefix("-webkit") }}</td> <td>{{ CompatGeckoDesktop("5.0") }}{{ property_prefix("-moz") }}</td> <td>10 {{ property_prefix("-ms") }} <a class="external" href="http://msdn.microsoft.com/en-us/ie/hh272902#_CSSAnimations" title="http://msdn.microsoft.com/en-us/ie/hh272902#_CSSAnimations"></a></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>{{ CompatUnknown() }}</td> <td>{{ CompatUnknown() }}</td> <td>{{ CompatUnknown() }}</td> <td>{{ CompatUnknown() }}</td> <td>{{ CompatUnknown() }}</td> </tr> </tbody> </table>
</div>
<h2>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-delay", "fr": "fr/CSS/animation-delay"} ) }}</p>
Revert to this revision