Skip to main content
Slides an element in and out by animating its height (or width) along with padding, margin, and border properties. The element appears to expand or collapse smoothly.

Usage

Parameters

number
default:"0"
Milliseconds before starting the transition
number
default:"400"
Duration of the transition in milliseconds
function
default:"cubicOut"
An easing function that controls the animation curve
'x' | 'y'
default:"'y'"
The axis along which to slide. Use 'y' for vertical sliding (height) or 'x' for horizontal sliding (width)

Example with parameters

Notes

The slide transition works best with elements that have a default display value of block, inline-block, flex, or grid. It may not work correctly with elements that have display: contents, display: inline, or display: table.