HTML CSS examples for CSS Property:transition-duration
The transition-duration CSS property sets the number of seconds (s) or milliseconds (ms) a transition animation to complete the transition.
The following table summarizes the transition-duration Property.
Item | Value |
---|---|
Default value: | 0s |
Applies to: | All elements, ::before and ::after pseudo-elements |
Inherited: | No |
Animatable: | No. |
The syntax of the property is as follows:
transition-duration: time | initial | inherit
The following table describes the values of this property.
Value | Description |
---|---|
time | duration to complete transition. The default value is 0s. Negative values are invalid. |
initial | Sets this property to its default value. |
inherit | take the value of its parent element transition-duration property. |
The example below shows the transition-duration property.
<!DOCTYPE html> <html lang="en"> <head> <title>Example of CSS3 transition-duration Property</title> <style type="text/css"> button {<!-- w w w . j av a2s . c o m--> font-size: 16px; font-weight: bold; padding: 10px 20px; background: #fe9854; border: 3px solid #dc5801; /* For Safari 3.0+ */ -webkit-transition-property: background, border; -webkit-transition-duration: 2s; /* Standard syntax */ transition-property: background, border; transition-duration: 2s; } button:hover { background: #48c677; border-color: #257644; } </style> </head> <body> <button type="button">Place mouse on me</button> </body> </html>