CSS Opacity 透明度解析

本文介绍了在CSS中实现元素透明度的多种方法,包括使用rgba颜色模式、直接设置opacity属性以及IE浏览器专用的alpha滤镜。这些方法适用于不同版本的浏览器,如IE6及以上版本,确保了网页设计的广泛兼容性。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

See original article https://dyingdown.github.io/2020/04/10/CSS-Opacity/

The followings are some ways of making one element transparent. Since different browser’s compatibility is different, we need many ways to write the opacity in order to fit as many as browsers as possible.

rgba

rgba(xxx,xxx,xxx,a) : This attribute has four parameters and the last one specify the opacity. The value of opacity is can be arbitrary between 0-1.

0 means totally transparent;

1 means not transparent.

0.5 means half trans parent.

Opacity

Another is directly wrote opacity: 0.8. This is the same as the forth parameter of rgba.

This code can fit many but the IE that is lower than version 8.

But this supports IE6. However, this effect can’t be tested under IE Tester.

Alpha (IE8)

filter: alpha(opacity=a);

a is any value between 0 and 100; a represents the degree of opacity.

0 stands for not transparent.

100 stands for not transparent.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值