--- title: animation-delay slug: Web/CSS/animation-delay tags: - CSS - CSS Animations - CSS Property - Experimental - Reference translation_of: Web/CSS/animation-delay --- <div>{{CSSRef}}{{SeeCompatTable}}</div> <h2 id="概述">概述</h2> <p><code>animation-delay</code> <a href="/en-US/docs/CSS" title="CSS">CSS</a>属性定义动画于何时开始,即从动画应用在元素上到动画开始的这段时间的长度。</p> <p><code>0s</code>是该属性的默认值,代表动画在应用到元素上后立即开始执行。否则,该属性的值代表动画样式应用到元素上后到开始执行前的时间长度;</p> <p>定义一个负值会让动画立即开始。但是动画会从它的动画序列中某位置开始。例如,如果设定值为-1s,动画会从它的动画序列的第1秒位置处立即开始。</p> <p>如果为动画延迟指定了一个负值,但起始值是隐藏的,则从动画应用于元素的那一刻起就获取起始值。</p> <p>通常用{{cssxref("animation")}}简写属性一次性设置动画效果较为方便。</p> <p>{{cssinfo}}</p> <h2 id="语法">语法</h2> <pre class="brush: css">animation-delay: 3s; animation-delay: 2s, 4ms; </pre> <h3 id="值">值</h3> <dl> <dt><code><time></code></dt> <dd>从动画样式应用到元素上到元素开始执行动画的时间差。该值可用单位为秒(s)和毫秒(ms)。如果未设置单位,定义无效。</dd> </dl> <h3 id="正式语法">正式语法</h3> {{csssyntax("animation-delay")}} <h2 id="示例">示例</h2> <p>参见<a href="/en-US/docs/CSS/CSS_animations" title="CSS/CSS_animations">CSS animations</a></p> <h2 id="规范">规范</h2> <table class="standard-table"> <thead> <tr> <th scope="col">规范</th> <th scope="col">状态</th> <th scope="col">备注</th> </tr> </thead> <tbody> <tr> <td>{{SpecName('CSS3 Animations', '#animation-delay', 'animation-delay')}}</td> <td>{{Spec2('CSS3 Animations')}}</td> <td></td> </tr> </tbody> </table> <h2 id="浏览器兼容性">浏览器兼容性</h2> <p>{{Compat("css.properties.animation-delay")}}</p> <h2 id="参见">参见</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> </ul>