Home > Article > Web Front-end > What is the code to set transparency in html5
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.
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:
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!