DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Snippets has posted 5883 posts at DZone. View Full User Profile

Applying Opacity To Images OnMouseover In CSS

08.23.2008
| 6552 views |
  • submit to reddit
        here's the CSS code for manipulating an image's opacity onMouseover

<style type="text/css">

.opacityit img{
filter:progid:DXImageTransform.Microsoft.Alpha(opacity=40);
-moz-opacity: 0.4;
}

.opacityit:hover img{
filter:progid:DXImageTransform.Microsoft.Alpha(opacity=100);
-moz-opacity: 1;
}

</style>

<a href="http://cnn.com" class="opacityit"><img border="0" src="email.gif" /></a>