HTML | DOM Style transition Property
The HTML DOM Style Property is used to change the appearance of any DIV element. It’s changing the appearance whenever the mouse has hovered over that element.
- For return the transition property:
- For set the transition property:
object.style.transition = "property duration timing-function delay|initial|inherit"
Return Values: It returns a string that represents the transition property of an element
|transitionProperty||Name of CSS property for transition effect.|
|transitionDuration||How much time is taken to complete the transition|
|transitionTimingFunction||Speed of transition|
|transitionDelay||Starting point of transition|
|initial||Set to default value|
|inherit||Inherit from its parent element|
Example: 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.
- Before Hover:
- While hovering the mouse after click on submit
Note 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 effect
- all: this 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 Browsers: The browser supporte by HTML | DOM Style transition Property are listed below:
- Google Chrome
- Apple Safari