Home > Article > Web Front-end > CSS opacity - Code to achieve translucency in images_Experience exchange
A few days ago, a friend who is doing web design asked me this question: How to achieve the translucent effect of images through CSS, and it can be supported on both IE and Mozilla. I will share my method with you below.
The picture below shows the image transparency effect achieved through CSS
This effect can work on both IE and Mozilla browsers, the code is as follows
In IE, "opacity" needs to be defined through "filter", while in Mozilla, "opacity" can be parsed directly, so if you want this effect to be supported in both browsers, you need to combine the two All settings are added. The setting for IE: this.filters.alpha.opacity=50 and the setting for Mozilla: this.style.MozOpacity=0.5. You can directly use this line of code to define the image. You only need to modify the image address to achieve it. Picture effect.