Image Rotation When Mouse Hovered Using CSS3

This post is all about a simple code snippet using the combination of the CSS3 and HTML which rotates an image at a certain degree when mouse is hovered on it ! This add-on piece of code make your web-page look more trendy.

Screenshots[Demo]:


The complete code is divided into two parts, the css and the HTML
The CSS part:
.hovrot {
  -webkit-transition: all 0.5s ease;
     -moz-transition: all 0.5s ease;
       -o-transition: all 0.5s ease;
      -ms-transition: all 0.5s ease;
          transition: all 0.5s ease;
  border-width: 2px;
  border-color: #594c2d;
  border-style: double;
  height:200px;
  width:200px;

}
 
.hovrot:hover {
  -webkit-transform: rotate(25deg);
     -moz-transform: rotate(25deg);
       -o-transform: rotate(25deg);
      -ms-transform: rotate(25deg);
          transform: rotate(25deg);
    color: #000000;
}

The HTML part:
<img src="img.jpg" class='hovrot' alt='This is a simple Image'/>
<b style="position: relative;top: -100px;padding:10 10;"> When Hovered -----> </b>
<img src="img.jpg" class='hovrot' alt='This is another simple Image'/>

The Complete Code:
<b><i>Image Rotation when hovered-</i></b><br />
<br />
<style>
.hovrot {
  -webkit-transition: all 0.5s ease;
     -moz-transition: all 0.5s ease;
       -o-transition: all 0.5s ease;
      -ms-transition: all 0.5s ease;
          transition: all 0.5s ease;
  border-width: 2px;
  border-color: #594c2d;
  border-style: double;
  height:200px;
  width:200px;

}
 
.hovrot:hover {
  -webkit-transform: rotate(25deg);
     -moz-transform: rotate(25deg);
       -o-transform: rotate(25deg);
      -ms-transform: rotate(25deg);
          transform: rotate(25deg);
    color: #000000;
}
</style>

<br />
<center>
<img src="img.jpg" class='hovrot' alt='This is a simple Image'/>
<b style="position: relative;top: -100px;padding:10 10;"> When Hovered -----> </b>
<img src="img.jpg" class='hovrot' alt='This is another simple Image'/>
</center>


Found Bugs, Report us, We will be glad to fix them all ! :)

Comments

Popular posts from this blog

Non Restoring Division Algorithm Implementation in C

Hackerrank String Reduction Solution

Bit Stuffing Code Implementation in Java