CSS – Transitions

If you want to change the property values on a web page, use the Transitions in CSS. Through this, easily change the element from one style to another. To set a transition effect, set the property for which you want to add an effect and the duration of the effect using the transition property, for example, transition for height:

Let us see some examples:

  • Set the transition for a property
  • Set the transition for multiple properties
  • Delay the Transition

Set the transition for a property

Let us now see the complete example to set the transition effect and change the height of a div on hover. We will set the transition for a single property height using the transition:

Output

CSS Transitions Output1

Now, hover over the box and the height will increase:

CSS Transitions Output2

Set the transition for multiple properties

In this example, we will set the transition for more than one property i.e. height and width here using the transition property:

Output

CSS Transitions for multiple properties Output1

Now, hover over the box. The height, as well as width, will increase i.e. transition:

CSS Transitions for multiple properties Output2

Delay the Transition

We can easily delay the transition using the transition-delay property. Let us see an example. Here, we will set the delay to 3 seconds:

Output

CSS Transitions Delay Output1

Hover over and after 3 seconds, the transition effect will be visible:

CSS Transitions Delay Output2

If you liked the tutorial, spread the word and share the link and our website Studyopedia with others.


Read More:

CSS Rounded Corners
CSS - Position
Studyopedia Editorial Staff
Studyopedia Editorial Staff
[email protected]

We work to create programming tutorials for all.

No Comments

Post A Comment

Discover more from Studyopedia

Subscribe now to keep reading and get access to the full archive.

Continue reading