HTML DOM Style transition Property Last Updated : 22 Apr, 2024 Comments Improve Suggest changes 4 Likes Like Report The HTML DOM Style Property is used to change the appearance of any DIV element. It changes the appearance whenever the mouse hovers over that element. SyntaxFor return the transition property:object.style.transitionFor set the transition property:object.style.transition = "property duration timing-function delay | initial | inherit"Return ValuesIt returns a string that represents the transition property of an element. Property ValuesValueDescriptiontransitionPropertyName of CSS property for transition effect.transitionDurationHow much time is taken to complete the transitiontransitionTimingFunctionSpeed of transitiontransitionDelayStarting point of transitioninitialSet to default valueinheritInherit from its parent elementExample: In this example, we are creating a div tag whose CSS is defined in style tag and when you hover the mouse on div tag after clicking on submit button the CSS will change from myDIV CSS to myDIV: hover CSS. html <!DOCTYPE html> <html> <head> <title> HTML DOM Style transition Property </title> <style> body { text-align: center; } #container { border: 1px solid black; border-radius: 5px; background-color: #e1e1e1; width: 200px; height: 100px; margin: auto; margin-bottom: 20px; } #container:hover { background-color: #228B22; width: 400px; } </style> </head> <body> <h2>HTML DOM Style transition Property</h2> <div id="container"></div> <button onclick="myFunction()"> Click Here! </button> <script> function myFunction() { document.getElementById("container").style.WebkitTransition = "width 3s"; document.getElementById("container").style.transition = "width 3s"; } </script> </body> </html> Output: Note: The transitionDuration can be only non-negative number and it can't be zero otherwise the transaction effect will not shown. Instead of all we can use following CSS properties: none: No properties get the transaction effectall: It is the default value all the properties will get the transaction effect.initial: Sets this property to its default value.inherit: Inherits this property from its parent element.Supported BrowsersGoogle Chrome 26 and aboveEdge 12 and aboveFirefox 16 and aboveInternet Explorer 10 and aboveOpera 12.1 and aboveApple Safari 9 and above Create Quiz Comment S Shahnawaz_Ali Follow 4 Improve S Shahnawaz_Ali Follow 4 Improve Article Tags : Web Technologies HTML HTML-DOM HTML-Property Explore HTML BasicsHTML Introduction4 min readHTML Editors4 min readHTML Basics7 min readStructure & ElementsHTML Elements4 min readHTML Attributes7 min readHTML Headings3 min readHTML Paragraphs3 min readHTML Text Formatting4 min readHTML Block and Inline Elements3 min readHTML Charsets4 min readListsHTML Lists3 min readHTML Ordered Lists5 min readHTML Unordered Lists4 min readHTML Description Lists3 min readVisuals & MediaHTML Colors11 min readHTML Links Hyperlinks2 min readHTML Images7 min readHTML Favicon4 min readHTML Video4 min readLayouts & DesignsHTML Tables9 min readHTML Iframes4 min readHTML Layout4 min readHTML File Paths3 min readProjects & Advanced TopicsHTML Forms5 min readHTML5 Semantics5 min readHTML URL Encoding4 min readHTML Responsive Web Design11 min readTop 10 Projects For Beginners To Practice HTML and CSS Skills8 min readTutorial ReferencesHTML Tags - A to Z List15+ min readHTML Attributes Complete Reference8 min readHTML Global Attributes5 min readHTML5 Complete Reference8 min readHTML5 MathML Complete Reference3 min readHTML DOM Complete Reference15+ min readHTML DOM Audio/Video Complete Reference2 min readSVG Element Complete Reference5 min readSVG Attribute Complete Reference8 min readSVG Property Complete Reference7 min readHTML Canvas Complete Reference4 min read Like