How to achieve translucent effect of images in css

王林
Release: 2020-11-26 17:49:07
Original
4807 people have browsed it

Css method to achieve image translucency: You can set it through the opacity attribute, such as [style="-moz-opacity:0.5";]. The opacity attribute is used to set the opacity level of an element, and the syntax is [opacity:value|inherit;].

How to achieve translucent effect of images in css

Environment of this article:

  • windows10, css3

  • Applicable to All brands of computers

Attribute introduction:

The opacity attribute sets the opacity level of the element.

(Learning video sharing:css video tutorial)

Grammar:

opacity: value|inherit;
Copy after login

Attribute value:

  • value Specifies opacity. From 0.0 (fully transparent) to 1.0 (fully opaque).

  • inherit The value of the opacity attribute should be inherited from the parent element.

The implementation code is as follows:

This effect can work on both IE and Mozilla browsers, the code is as follows

powerbookg4.jpg
Copy after login

In IE The transparency "opacity" needs to be defined through "filter", and "opacity" can be parsed directly in Mozilla, so if you want this effect to be supported in both browsers, you need to add both settings.

Settings for IE: this.filters.alpha.opacity=50; settings for Mozilla: this.style.MozOpacity=0.5.

Related recommendations:CSS tutorial

The above is the detailed content of How to achieve translucent effect of images in css. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!