Image Hover Effect using CSS3

Previously it were the days of CSS 2.1 when designing web templates were limited and had to use JavaScript to add some special effects. But as days passed, technology improved and CSS3 was introduced. Working with CSS3 is fun as it can do much more and can handle many new effects without any use of JavaScript.

Today I am going to tell you how to change opacity (transparency) of an image and add hover effect using CSS3. See the example below, you will find that whenever you place your mouse pointer over the image, it will hover form transparent to full opaque and with some transition effect.

CSS3 image hover effect

This is done by using HTML and CSS3 which are used by developers and designers, but if you are a newbie then also you can do it. In this tutorial, I will tell you how this hover effect can be done for your images by adding some snippets on Blogger templates.

Step 1: Go to Template tab of your blog from Blogger dashboard and click "Edit HTML". Find ]]></b:skin> and just before it add the following CSS codes:

img.hovereffect {
 opacity: 0.5;
 -webkit-transition: all .3s linear;
 -moz-transition: all .3s linear;
 -o-transition: all .3s linear;
 transition: all .3s linear;
}
img.hovereffect:hover {
 opacity: 1;
}

Save your template. Now all is left for you is to add class="hovereffect" to your images. For instance, when you add an image in HTML/Compose mode from Blogger Post Editor, in HTML mode it will look like:

<div class="seperator" style="clear: both;">
<a href="http://the-image.jpg"><img height="240" src="http://the-image.jpg" width="320" /></a>
</div>

But, to add this effect, you need to add the class as shown below:

<div class="seperator" style="clear: both;">
<a href="http://the-image.jpg"><img height="240" class="hovereffect" src="http://the-image.jpg" width="320" /></a>
</div>

Publish your post and see if this has made any visual changes to your image or not.

Explanation
  • opacity - Change the value 0.5 if you wish to make the image more transparent or opaque.
  • hovereffect - To have this transparency effect, you can use this definition for multiple images.

This is only one example but you can use many CSS3 effects on Blogger.

Popular posts from this blog

How to Resize Blogger Header to Logo Size

Create your own Contact Form with Kontactr for Blogger

Add Google Website Translator to Blogger