css3中怎么调节透明度

属性介绍:

opacity 属性设置元素的不透明级别。

语法:

opacity: value|inherit;

属性值:

  • value 规定不透明度。从 0.0 (完全透明)到 1.0(完全不透明)。

  • inherit 应该从父元素继承 opacity 属性的值。

调节透明度的方法:

<!DOCTYPE html>
<html>
<head>
<style> 
div
{
background-color:red;
opacity:0.5;
filter:Alpha(opacity=50); /* IE8 以及更早的浏览器 */
}
</style>
</head>
<body>

<div>本元素的不透明度是 0.5。请注意,文本和背景色都受到不透明级别的影响。</div>

</body>
</html>

运行结果:

<img alt=\"CSS3中怎么调节透明度\” alt=\”2a627aca416d7d621aead0d99daa3c7.png\” src=\”https://www.freexyz.cn/d/file/20210224/68678a23f219948c6068144b10676fd3.png\” title=\”1614157622823695.png\” />

© 版权声明
THE END
喜欢就支持一下吧
点赞0 分享
评论 抢沙发

请登录后发表评论

    暂无评论内容