Technology,
Web Design
Sunday, February 7, 2010 at 10:34AM
To change the opacity of an image you can use this CSS 3 Code:
<img src="http://mikebite.com/testimage_01" alt="TestImage" style="opacity:0.5;filter: alpha(opacity=50) ;" />
Change more than one image with an anchor tag or create an hover effect:
#imghover a:hover img { filter: alpha(opacity=50);filter: progid:DXImageTransform.Microsoft.Alpha(opacity=50);-moz-opacity: .5;opacity:0.5; }
affects this HTML
<div id="imghover">
<a href="#"><img src="http://mikebite.com/testimage_01" alt="TestImaget" style="width:50px;height:50px" /></a>
</div>
Same idea with a separate class (makes hover effect even simpler)
.imageopacity {
opacity:0.25;
-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(opacity=25)";
filter:alpha(opacity=25);
zoom:1
}
.imageopacity:hover {
opacity:1;
-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(opacity=100)";
filter:alpha(opacity=100)
}
affects this HTML
<img src="testimage_01.jpg" class="imageopacity" alt="TestImageHover" />
Reader Comments