Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How does css use the transparent property to set transparency

2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

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!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report