HowTo Make Image Hovering Effect with Simple CSS Code

June 17, 2010

in HowTo,Tricks,Tutorials

CSS stands for Cascading Style Sheets which is used for presenting the design of a page. With CSS all you need to do is put a piece of code in your style sheet to automagically make anything work. Today we will see simple image hovering effect using piece of CSS code.

You can use the image hovering effect in all your blog post, it will look awesome. All you need to do is, just add small piece of code in your custom style sheet and when ever adding images, use “linkopacity” class

Steps to Follow on WordPress Blogs –

1. Go to your stylesheet.css

2. Insert this code

#center{ text-align:center; padding:auto auto auto auto;}
a.linkopacity img {
filter:alpha(opacity=50);
-moz-opacity: 0.5;
opacity: 0.5;
-khtml-opacity: 0.5;}

a.linkopacity:hover img {
filter:alpha(opacity=100);
-moz-opacity: 1.0;
opacity: 1.0;
-khtml-opacity: 1.0; }

3. Then add a class=”linkopacity” to the link when you want to make the rollover. It works with hyperlinked text and images.

For example : when ever you add images, just go to html view and add

<a class=”linkopacity” >

It should look like

<a class=”linkopacity” ><img src=”http://yourblogname.com/imagename.jpg”></a>

That’s it. Done !

Steps to Follow For Blogspot Blogs -

1. Put the code in the head section of your template between the head tags

<head>
<title>CSS Image Hover Effect</title>
<style type=”text/css”>
#center{ text-align:center; padding:auto auto auto auto;}
a.linkopacity img {
filter:alpha(opacity=50);
-moz-opacity: 0.5;
opacity: 0.5;
-khtml-opacity: 0.5;}

a.linkopacity:hover img {
filter:alpha(opacity=100);
-moz-opacity: 1.0;
opacity: 1.0;
-khtml-opacity: 1.0; }

</style>
</head>

css HowTo Make Image Hovering Effect with Simple CSS Code

2. Then add a class=”linkopacity” to the link when you want to make the rollover. It works with hyperlinked text and images.

For example : when ever you add images, just go to html view and add

<a class=”linkopacity” >

It should look like

<a class=”linkopacity” ><img src=”http://yourblogname.com/imagename.jpg”></a>

That’s it. Done !

You can see the live demo below, Just move your mouse over the picture and see the simple effect.

 HowTo Make Image Hovering Effect with Simple CSS Code

Got Something to say ? Do you have any similar kind of tips for image hovering effect ? Share with us !


Liked this post? Got something to say? Share/Comment below. You can also Get Regular Updates. Subscribe to Free RSS Feeds or Email Updates. Follow us on Twitter @madrasgeek and Like us on Facebook.

Subscribe to MadrasGeek for daily tips in your email inbox for free:

Share :

{ 5 trackbacks }

Tweets that mention HowTo Make Image Hovering Effect with Simple CSS Code -- Topsy.com
June 17, 2010 at 4:54 pm
HowTo Make Image Hovering Effect with Simple CSS Code : : css
June 17, 2010 at 5:08 pm
HowTo Make Image Hovering Effect with Simple CSS Code | My Blog
June 17, 2010 at 5:52 pm
HowTo Make Image Hovering Effect with Simple CSS Code | CSS Guru How to CSS
June 17, 2010 at 11:48 pm
Image Hovering Effect with Simple CSS Code - PSD to HTML
June 18, 2010 at 6:36 pm

{ 7 comments… read them below or add one }

1 Shekhar Sahu June 18, 2010 at 12:42 pm

You need to make corrections for blogger.

Reply

2 ashwin June 19, 2010 at 12:00 pm

what corrections ..please specify here. as i want to add this on ma blog.

Reply

3 Srivathsan G.K June 19, 2010 at 12:36 pm

There is no need of corrections, just place the css code in your style sheet which is below head tag. Place it and save it. Now add link opacity class to your image. Live example on blogspot blog – check out – http://dailysearch123.blogspot.com/2010/06/example-of-image-hovering-effect-using.html

Reply

4 ashwin June 19, 2010 at 2:22 pm

thanks dude. it is not working when u place it just after head or just before closing head. correction:-
find ]]>
and past this code above it

a.linkopacity img {
filter:alpha(opacity=50);
-moz-opacity: 0.5;
opacity: 0.5;
-khtml-opacity: 0.5;}

a.linkopacity:hover img {
filter:alpha(opacity=100);
-moz-opacity: 1.0;
opacity: 1.0;
-khtml-opacity: 1.0; }

Reply

5 ashwin June 19, 2010 at 1:39 pm

thanks for the share i was thinking to add this effect on my social networking widget , and i got it here. am going to add this now ;P

Reply

6 Luxury Boutique Hotels September 15, 2010 at 8:21 am

Hi, I was looking for an effect that I thought would be “hovering”, but apparently it’s not. What I want is to have social icons that are always on the right side of the screen for WordPress. Even when you scroll down, they should stay in the same position. How can this be achieved? Thanks!

Reply

7 Srivathsan G.K September 15, 2010 at 8:44 am

will write a tutorial on what you’re asking. It can be done easily. Floating icons on the right side of wordpress blog.

Reply

Leave a Comment

Previous post:

Next post: