Вы находитесь на странице: 1из 3

6/28/2015 transition ­ CSS | MDN

transition
 This is an experimental technology
Because this technology's specification has not stabilized, check the compatibility table for the proper
prefixes to use in various browsers. Also note that the syntax and behavior of an experimental
technology is subject to change in future versions of browsers as the spec changes.

Summary
The CSS transition property is a shorthand property for transition­property, transition­
duration, transition­timing­function, and transition­delay. It enables you to define the
transition between two states of an element. Different states may be defined using pseudo­classes like
:hover or :active or dynamically set using JavaScript.

Initial value the concatenation of the initial values of its longhand properties:
transition­delay: 0s
transition­duration: 0s
transition­property: all
transition­timing­function: ease

Applies to all elements, ::before and ::afterpseudo­elements

Inherited no

Media interactive

Computed value as specified

Animatable no

Canonical order order of appearance in the formal grammar of the values

Syntax
1 /* Apply to 1 property */
2

https://developer.mozilla.org/en/docs/Web/CSS/transition 1/3
6/28/2015 transition ­ CSS | MDN

3 /* property name | duration */
4 transition: margin‐left 4s;
5

6 /* property name | duration | delay */
7 transition: margin‐left 4s 1s;
8

9 /* property name | duration | timing function | delay */
10 transition: margin‐left 4s ease‐in‐out 1s;
11

12 /* Apply to 2 properties */
13 transition: margin‐left 4s, color 1s;
14

15 /* Apply to all changed properties */
transition: all 0.5s ease‐out;

Note that order is important within the items in this property: the first value that can be parsed as a time is
assigned to the transition­duration, and the second value that can be parsed as a time is assigned to
transition­delay.

See When property value lists are of different lengths for details on how things are handled when lists of
property values aren't the same length. In short, extra transition descriptions beyond the number of
properties actually being animated are ignored.

Formal syntax
<single‐transition>#

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

Specifications
Specification Status Comment

 CSS Transitions
WD Working Draft  
The definition of 'transition' in that specification.

Browser compatibility

https://developer.mozilla.org/en/docs/Web/CSS/transition 2/3
6/28/2015 transition ­ CSS | MDN

Desktop   Mobile

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari


Basic support 1.0  ­we b kit 4.0 (2.0)  ­mo z 10.0 11.6  ­o 3.0  ­we b kit
26.0 16.0 (16.0) 12.10  # 6.1

See also
Using CSS transitions
TransitionEvent
Transitions­related properties: transition, transition­delay, transition­duration,
transition­property, transition­timing­function

https://developer.mozilla.org/en/docs/Web/CSS/transition 3/3

Вам также может понравиться