CSS propertyTransitions

transition-property

Specifies which CSS properties should change smoothly.

Initial value
all
Inherited
No
Animatable
no
Applies to
all elements and the ::before and ::after pseudo-elements
JavaScript
element.style.transitionProperty = "opacity, transform"
On this page

Example

#
CSS
.link {
  transition-property: color, text-decoration-color;
  transition-duration: 0.2s;
}
Preview

Definition and usage

#

The transition-property property takes a list of property names the transition applies to. All other changes happen immediately.

The all value animates everything that changes and can be animated. It is convenient, but it may accidentally animate things like height or border, which can be expensive and unexpected.

Not every property is animatable. For example, display changes abruptly by default, although transition-behavior: allow-discrete lets you include it in a transition.

Syntax

#
Syntax
transition-property: none | all | <property-name> [, …]*;

Values

#
  • all

    Both position and colour change smoothly.
  • transform

    Smooth movement, the colour changes abruptly.
  • background-color

    Smooth colour change, abrupt movement.
  • none

    No change is smooth.

Values in practice

#

all

Both position and colour change smoothly.
.demo { transition-property: all; }

transform

Smooth movement, the colour changes abruptly.
.demo { transition-property: transform; }

background-color

Smooth colour change, abrupt movement.
.demo { transition-property: background-color; }

none

No change is smooth.
.demo { transition-property: none; }

Browser support

#

Widely available

Works in all modern browsers, phones included. You can use it without worry.

  • Chrome
  • Edge
  • Firefox
  • Safari

Good practices

#
  • List only the properties that should really animate. Your transitions will be predictable.
  • The order in the property list matches the order of the times in transition-duration.

Related entries

#

Practise it in lessons

#

Spotted a mistake or missing an example? Write to us.