css transparent属性_css 透明颜色transparent的使用

在css中 transparent到底是什么意思呢? transparent 它代表着全透明黑色,即一个类似rgba(0,0,0,0)这样的值。

例如在css属性中定义:background:transparent,意思就代表背景透明。

实际上background默认的颜色就是透明的属性,所以写和不写都是一样的。

transparent一般使用场景:

如果一个元素覆盖在另外一个元素之上,而你想显示下面的元素,这时你就需要把上面这个元素的background设置为transparent

资源网站搜索大全https://55wd.com

 transparent在不同css版本中使用:

CSS1中,transparent被用来作为background-color的一个参数值,用于表示背景透明。
CSS2中,border-color也开始接受transparent作为参数值,《Open eBook(tm) Publication Structure 1.0.1》[OEB101]延伸到color也接受transparent作为参数值。
CSS3中,transparent被延伸到任何一个有color值的属性上。

 transparent例子:

<style>
.dom {
    color: transparent;
    border: 1px solid transparent;
    background: transparent;
}
</style>
<div class="dom">背景,文字颜色,border透明</div>
原文地址:https://www.cnblogs.com/ypppt/p/13229542.html