Home  >  Article  >  Web Front-end  >  How to set the transparency of html images

How to set the transparency of html images

青灯夜游
青灯夜游Original
2021-10-11 14:36:3125535browse

How to set the transparency of html images: 1. Use the style attribute in the img element to set the "opacity: transparency value;" style; 2. Use the style attribute in the img element to set "filter:opacity (transparency value) ;"style.

How to set the transparency of html images

The operating environment of this tutorial: Windows 7 system, CSS3&&HTML5 version, Dell G3 computer.

htmlimage

In HTML, you can use the img element to embed an image into a web page.

Please note that technically the How to set the transparency of html images tag does not insert an image into the web page, but rather links the image from the web page. The How to set the transparency of html images tag creates a placeholder for the referenced image.

<img  src="img/1.jpg"    style="max-width:90%" / alt="How to set the transparency of html images" >

How to set the transparency of html images

html Image setting transparency

Method 1: Use the style attribute in the img element to set "opacity: transparency Value;" style

<img  src="img/1.jpg"    style="max-width:90%" style="opacity: 0.5;"/ alt="How to set the transparency of html images" >

How to set the transparency of html images

Method 2: Use the style attribute in the img element to set the "filter:opacity (transparency value);" style

<img  src="img/1.jpg"    style="max-width:90%" style="filter:opacity(0.3);"/ alt="How to set the transparency of html images" >

How to set the transparency of html images

Recommended tutorial: "html video tutorial"

The above is the detailed content of How to set the transparency of html images. For more information, please follow other related articles on the PHP Chinese website!

Statement:
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