transition-duration

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

Revision Content

{{ CSSRef() }}

{{ SeeCompatTable() }}

Summary

The transition-duration CSS property specifies the number of seconds or milliseconds a transition animation should take to complete. By default, the value is 0s, meaning that no animation will occur.

You may specify multiple durations; each duration will be applied to the corresponding property as specified by the {{ cssxref("transition-property") }} property, which acts as a master list. If there are fewer durations specified than in the master list, missing values are set to the initial value (0s). If there are more durations, the list is simply truncated to the right size. In both case the CSS declaration stays valid.

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

Syntax

transition-duration: time[, time]*

where :

time
Is a {{ xref_csstime() }} denoting the amount of time the transition from the old value of a property to the new value should take.

Examples

There are several examples of CSS transitions included in the main CSS transitions article.

Specifications

Specification Status Comment
CSS Transitions Level 3 {{ Spec2('CSS3 Transitions') }}  

Browser compatibility

{{ CompatibilityTable() }}

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari
Basic support 1.0 {{ property_prefix("-webkit") }} {{ CompatGeckoDesktop("2.0") }} {{ property_prefix("-moz") }}
{{ CompatGeckoDesktop("16.0") }}
10.0 11.6 {{ property_prefix("-o") }} 3.0 {{ property_prefix("-webkit") }}
Feature Android Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile
Basic support 2.1 {{ property_prefix("-webkit") }} {{ CompatGeckoMobile("2.0") }} {{ property_prefix("-moz") }}
{{ CompatGeckoMobile("16.0") }}
{{ CompatUnknown() }} 10.0 {{ property_prefix("-o") }} 3.2 {{ property_prefix("-webkit") }}

See also

Revision Source

<p>{{ CSSRef() }}</p>
<p>{{ SeeCompatTable() }}</p>
<h2 id="Summary">Summary</h2>
<p>The <code>transition-duration</code> <a href="/en/CSS" title="CSS">CSS</a> property specifies the number of seconds or milliseconds a transition animation should take to complete. By default, the value is <code>0s</code>, meaning that no animation will occur.</p>
<p>You may specify multiple durations; each duration will be applied to the corresponding property as specified by the {{ cssxref("transition-property") }} property, which acts as a master list. If there are fewer durations specified than in the master list, missing values are set to the initial value (<code>0s</code>). If there are more durations, the list is simply truncated to the right size. In both case the CSS declaration stays valid.</p>
<ul class="cssprop">
  <li><dfn>{{ Xref_cssinitial() }}:</dfn> <code>0s</code></li>
  <li><dfn>Applies to:</dfn> all elements, {{ cssxref("::before") }} and {{ cssxref("::after") }} pseudo elements</li>
  <li><dfn>{{ Xref_cssinherited() }}:</dfn> no</li>
  <li><dfn>Media:</dfn> {{ Xref_cssinteractive() }}</li>
  <li><dfn>{{ Xref_csscomputed() }}:</dfn> as specified</li>
</ul>
<h2 id="Syntax">Syntax</h2>
<pre>transition-duration: <em>time</em>[, <em>time</em>]*
</pre>
<p>where :</p>
<dl>
  <dt>
    <code>time</code></dt>
  <dd>
    Is a {{ xref_csstime() }} denoting the amount of time the transition from the old value of a property to the new value should take.</dd>
</dl>
<h2 id="Examples">Examples</h2>
<p>There are several examples of CSS transitions included in the main <a href="/en/CSS/CSS_transitions" title="en/CSS/CSS transitions">CSS transitions</a> article.</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><a class="external" href="http://dev.w3.org/csswg/css3-transitions/#transition-duration-property">CSS Transitions Level 3</a></td>
      <td>{{ Spec2('CSS3 Transitions') }}</td>
      <td> </td>
    </tr>
  </tbody>
</table>
<h2 id="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</th>
      </tr>
      <tr>
        <td>Basic support</td>
        <td>1.0 {{ property_prefix("-webkit") }}</td>
        <td>{{ CompatGeckoDesktop("2.0") }} {{ property_prefix("-moz") }}<br>
          {{ CompatGeckoDesktop("16.0") }}</td>
        <td>10.0</td>
        <td>11.6 {{ property_prefix("-o") }}</td>
        <td>3.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 Mobile</th>
        <th>Opera Mobile</th>
        <th>Safari Mobile</th>
      </tr>
      <tr>
        <td>Basic support</td>
        <td>2.1 {{ property_prefix("-webkit") }}</td>
        <td>{{ CompatGeckoMobile("2.0") }} {{ property_prefix("-moz") }}<br>
          {{ CompatGeckoMobile("16.0") }}</td>
        <td>{{ CompatUnknown() }}</td>
        <td>10.0 {{ property_prefix("-o") }}</td>
        <td>3.2 {{ property_prefix("-webkit") }}</td>
      </tr>
    </tbody>
  </table>
</div>
<h2 id="See_also">See also</h2>
<ul>
  <li><a href="/en-US/docs/CSS/Using_CSS_transitions" title="en/CSS/CSS transitions">Using CSS transitions</a></li>
  <li>{{ domxref("TransitionEvent") }}</li>
  <li>{{ CSS_Reference:transitions() }}</li>
</ul>
Revert to this revision