Get the App
SLTechnology News&Howtos  ›  Development  › 

How does css use the transparent property to set transparency

Shulou Source: shulou.com Published: 2022-06-01 10:53:16 10月05日 Update

This article is about how css uses the transparent property to set transparency. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.

So, are you going to ask what the csstransparent attribute is and what's the use?

In fact, csstransparent is an all-transparent black (black) shorthand, that is, a value similar to rgba; it is used to specify a fully transparent color.

For example:

We define it in css: background:transparent, which means setting the background to be transparent.

However, in fact, the default color of background is transparent, so both write and unwrite are the same. So why do you sometimes need to set background to transparent? In what scenarios will transparent be used:

When one element overrides another and you want to display the following element, you need to set the background of the above element to transparent

The use of the transparent attribute in different css versions:

In css1, transparent is used as a parameter value of background-color to indicate background transparency.

In css2, border-color also begins to accept transparent as a parameter value, and "OpeneBook (tm) PublicationStructure1.0.1" [OEB101] extends to color and accepts transparent as a parameter value.

In css3, transparent is extended to any attribute that has a color value.

Let's look at compatibility:

1.jpg

# 1:border-color does not accept this value

# 2:color does not accept this value

The transparent property draws various triangles (used with the border property)

* {

Margin:0

Padding:0

}

.demo {

Margin:40pxauto

Width:800px

/ * background-color:#f0ac6b;*/

}

.demo * {

Float:left

Margin:20px30px

Width:0px

Height:0px

}

.t1 {

/ * background-color:#f0ac6b;*/

Border-bottom:40pxsolidred

Border-right:20pxsolidtransparent

Border-left:20pxsolidtransparent

}

.t2 {

/ * background-color:#f0ac6b;*/

Border-bottom:40pxsolidtransparent

Border-right:40pxsolidred

/ * border-left:20pxsolidtransparent;*/

}

.t3 {

Border-top:40pxsolidred

Border-right:20pxsolidtransparent

Border-left:20pxsolidtransparent

}

.t4 {

Border-top:40pxsolidtransparent

Border-left:40pxsolidred

}

.t5 {

Border-top:40pxsolidred

Border-right:40pxsolidtransparent

}

.t6 {

Border-left:40pxsolidtransparent

Border-bottom:40pxsolidred

}

.t7 {

Border-left:40pxsolidred

Border-bottom:20pxsolidtransparent

Border-top:20pxsolidtransparent

}

.t8 {

Border-right:40pxsolidred

Border-bottom:20pxsolidtransparent

Border-top:20pxsolidtransparent

}

Thank you for reading! This is the end of this article on "how css uses the transparent attribute to set transparency". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it out for more people to see!

Tags: Attributes elements parameters transparency content more articles backgrounds different good practical triangles representatives examples compatibility scenarios actually in fact meaning Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno NVidia vpn MySQL Redmi Microsoft