CSS 3 Rollover Effect

In the web, when you changes mouse hover on any object, if that object rolls and come back on its original position that is called Rollover effect. You can apply different codes to get this effect like HTML, Javascript etc. Now I will show you rollover effect using CSS3 which is a recent most used web styling method. CSS3 has reduced the Javascript and Jquery coding on webpage and this helps to load your site and blog faster in the web.

How to Make Rollover Effect Using CSS3?


In the beginning, I will suggest you to find on which web object you are going to give rollover effect then just apply the given codes.

.social ul li img
{
     transition:linear 0.4s;
}
The given above code is just for my own object. Here now I am  going to apply rollover effect on social media icons. 'transition' is the attributes of the css3 technology and if you do not know much more about css3 and its coding technique, then you simply can go through css3generator and get css3 codes. Actually, the above code is not compulsory for rollover effect which just give function and duration on a property but the below code is a compulsory code which you must include.
.social ul li img:hover
{
-webkit-transform: rotate(360deg);
-moz-transform: rotate(360deg);
-o-transform: rotate(360deg);
-ms-transform: rotate(360deg);

-webkit-transition: all .5s ease-out;
-moz-transition: all .5s ease-out;
-ms-transition: all .5s ease-out;
-o-transition: all .5s ease-out;
transition: all .5s ease-out;
}
Note: On the above code, I wrote '.social' which is a class of a particular img attribute. So do not think that you always write this code. You can write whatever class and attribute but one thing that you must be sure is transform property must be included and which value must be 'rotate(360deg)' because if an object rolls, then that must complete a circular form.

The second code says when you do hover on an list (li), then its image will rotate on 360 deg. And there are four different code which do nearly same job on different browser.

This is a demo of Rollover Effect.

Post a Comment

0 Comments