Course contentsShow
← Web Development
Lesson 509 of 2,9829. CSS Transitions and AnimationsFree lesson

Properties That Can and Cannot Transition

Identifying which CSS properties support smooth transitions and which do not.

Properties That Can and Cannot Transition

What you'll learn: You'll discover which CSS properties can smoothly transition and which ones change instantly, helping you avoid unexpected animation behavior.

The Core Concept

Not all CSS properties are created equal when it comes to transitions. Some properties support smooth, gradual changes (like opacity fading from 0 to 1), while others can only flip instantly between values (like display changing from block to none).

Think of it like this: Some properties are like a dimmer switch that gradually brightens a room, while others are like a regular light switch that's either on or off—no in-between.

Properties That Can Transition

Properties that can transition are those with intermediate values. The browser can calculate steps between the start and end:

  • Colors: color, background-color, border-color
  • Lengths: width, height, margin, padding, font-size
  • Numbers: opacity, z-index
  • Transforms: transform (translate, rotate, scale)
  • Filters: filter properties like blur() or brightness()

Properties That Cannot Transition

Properties with discrete values cannot transition smoothly:

  • display (you can't be "half block")
  • visibility (though it delays the change)
  • font-family (you can't blend fonts)
  • position (no halfway between relative and absolute)

When you try to transition these, they'll simply jump from one value to another at the end of the duration.

Why This Matters

Understanding this prevents frustration when a transition doesn't work as expected. If you need to hide an element smoothly, use opacity (which can transition) instead of display (which cannot).

Key Takeaway: Only CSS properties with calculable intermediate values can transition smoothly—properties like colors, sizes, and opacity work beautifully, while discrete properties like display and font-family will always change instantly.