First we will write a CSS file (Save this file as “opacity.css”)
body
{
background-color: #ffffff;
}
.toggleopacity img{
filter:progid:DXImageTransform.Microsoft.Alpha(opacity=100);
-moz-opacity: 0.5;
}
.toggleopacity:hover img{
filter:progid:DXImageTransform.Microsoft.Alpha(opacity=50);
-moz-opacity: 0.5;
}
.toggleopacity img{
border: 0px solid #ccc;
}
Now we will write a html file (Save this file as image.html)
<html>
<head>
<title>
Image Opacity Using CSS
</title>
<link href=”opacity.css” type=”text/css” rel=”stylesheet”>
</head>
<body>
<a href=”#”>
<img src=”home2.jpg” width=”100″ height=”57″ /> <!– Use your image url here –>
</a>
</body>
</html>
Test the code and change stylesheet as per requirement.

