Home >Web Front-end >Front-end Q&A >What is the code to set transparency in html5

What is the code to set transparency in html5

WBOY
WBOYOriginal
2021-12-17 13:47:346382browse

In HTML5, the code for setting transparency is "style="opacity:transparency value"". The style attribute is used to set the style of the element. The opacity attribute is used to set the opacity level of the element. The value of the opacity attribute From 0 to 1, the smaller the transparency value, the more transparent the element.

What is the code to set transparency in html5

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

html5What is the code for setting transparency

The opacity attribute sets the opacity level of the element. The code is as follows:

style="opacity:透明度值"

The style attribute is used to set the style of the element. The value of the opacity attribute is from 0 to 1. The smaller the transparency value, the more transparent the element.

The example is as follows:

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
</head>
<body>
<h1 style="opacity:0.5">设置透明度</h1>
</body>
</html>

Output result:

What is the code to set transparency in html5

Recommended tutorial: "html video tutorial"

The above is the detailed content of What is the code to set transparency in html5. 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