Burns Vaughan's profile

CSS Opacity Transition Example

An Example of a Transition in CSS, Changes the Opacity.​​​​​​​​​​​​​​
Hey guys! I wanted to share a quick snippet of code and the way I do transitions. The method applies to almost all properties not just opacity.

And there is a css opacity transition example so that you can see it working and make adjustments or copy paste it to your own project.

How it is done:

1) Take any element for example a p tag, or div. 

2) In your css stylesheet call the html element. For example, if you gave it a class name of “chippy” call it using .chippy{} easy if you have used css once in your life

3) Add :hover to the element that you want to transition. So if it is .chippy add the text afterwards .chippy:hover {}.

Note: The transition will occur with a mouse over, more complicated effects require you to know how to javascript and I will link to these once I get them up. 

4) It is useful to call the class twice in your css stylesheet... once for the original state (with all it's properties), and once after the element has been hovered over with a mouse (see example). 

5) if you want to adjust the opacity in my example it is text, make them different in the original call and in the element call with :hover after it.

This is all that needs to be done so that the opacity.

Any other style of the element you choose will transition when the mouse hovers over the element.​​​​​​​
CSS Opacity Transition Example
Published:

CSS Opacity Transition Example

Published:

Creative Fields