How html sets the transparency of div
This article focuses on "how to set the transparency of html div", interested friends may wish to take a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn how to set the transparency of div by html.
Html set div transparency method: 1, use the opacity attribute, only need to add "opacity: transparency value;" style to the div element; 2, use the filter attribute, only need to add "filter:opacity (transparency value);" style to the div element.
The operating environment of this tutorial: windows7 system, CSS3&&HTML5 version, Dell G3 computer.
Html sets the transparency of div
.box1 {width: 300px; height: 200px; background-color: yellow;} .box2 {width: 100px Height: 100px; background-color: green;}
1. Using the opacity attribute setting, the smaller the transparency value, the more transparent it is.
.box2 {width: 100px; height: 100px; background-color: green; opacity: 0.8;}
.box2 {width: 100px; height: 100px; background-color: green; opacity: 0.5;}
.box2 {width: 100px; height: 100px; background-color: green; opacity: 0.2;}
2. Use filter:opacity (transparency value); the smaller the transparency value, the more transparent it is.
.box2 {width: 100px; height: 100px; background-color: green; filter:opacity (0.5);}
.box2 {width: 100px; height: 100px; background-color: green; filter:opacity (0.1);}
At this point, I believe you have a deeper understanding of "how html sets the transparency of div". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!