How to get an image to fade in when the mouse is hovered over?

735 views Asked by At

I received this tip:

.container img{
     width:125px;
     margin;0;
     padding:0;
     opacity:0.5;
}
.container img:hover{
   opacity:1;
} 

Tried it and it worked great!

I then used a light version of a Custom CSS Editor Plugin - popped the code into it and added the class container <p class="container"> to the images and it worked.

1

There are 1 answers

0
ab29007 On BEST ANSWER

you can use opacity property for the image:

.container img{
  width:300px;
  margin;0;
  padding:0;
  opacity:0.5;
}
.container img:hover{
  opacity:1;
}
<div class="container">
  <img src="http://www.booths.co.uk/wp-content/uploads/640px-X-360px-Chocolate-MiniNests.jpg"/>
</div>