HTML | DOM Style transitionDuration Property
The Style transitionDuration property in HTML DOM is used to set or return the length of time(in seconds or milliseconds) to complete the transition effect.
Syntax:
object.style.transitionDuration
object.style.transitionDuration = "time|initial|inherit"
Property Values:
- time:It is used to specify how much time it will take to complete transition effect.The default value is 0(no transition effect).
- initial: Sets the element to its initial position.
- inherit: It is used to set property from its parent element.
Example: Set transitionDuration property.
<!DOCTYPE html> <html> <head> <title> HTML | DOM Style transitionDuration Property </title> <style> #element { width: 100px; height: 70px; background: green; transition-property: width; } #element:hover { width: 400px; height: 100px; } </style> </head> <body> <h1>GeeksforGeeks</h1> <h2>TransitionDuration Property</h2> <p> Move mouse over the green box and it will change! </p> <div id="element"> <h3>transition-duration:5s</h3> </div> <script> function myFunction() { // Set transitionDuration 5 second. document.getElementById( "element").style.transitionDuration = "5s"; } myFunction() </script> </body> </html> |
chevron_right
filter_none
Output:
- Before Transition:

- After Transition:

Supported Browsers: The browser supporte by HTML | DOM Style transitionDuration Property are listed bwlow:
- Google Chrome 26
- Internet Explorer 10
- Firefox 16
- Opera 12.1
- Safari 6.1
Recommended Posts:
- HTML | DOM Style top Property
- HTML | DOM Style right Property
- HTML | DOM Style transitionProperty Property
- HTML | DOM Style perspective Property
- HTML | DOM Style position Property
- HTML | DOM Style order Property
- HTML | DOM Style clear Property
- HTML | DOM Style columnFill Property
- HTML | DOM Style cssFloat Property
- HTML | DOM Style isolation Property
- HTML | DOM Style backgroundColor Property
- HTML | DOM Style flexBasis Property
- HTML | DOM Style wordSpacing Property
- HTML | DOM Style textAlign Property
- HTML | DOM Style visibility Property
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.



