offline version v3


250 of 298 menu

transition-duration property

The transition-duration property sets a smooth transition duration.

Syntax

selector { transition-duration: duration in s or ms; }

Values

Value Description
s Specifies a time in seconds (for example 3s). You can set fractional values, for example, 0.5s - half a second.
ms Specifies a time in milliseconds (for example 3ms). One second is 1000 milliseconds.

Default value: 0s.

Example

Hover your mouse over the block - it will smoothly change its width in 2 seconds.

<div id="elem"></div> #elem { transition-duration: 2s; transition-property: width; border: 1px solid black; height: 50px; width: 100px; } #elem:hover { width: 400px; }

:

See also

enru