纯CSS实现背景半透明文字不透明效果兼容IE6

建站知识 2021-07-03 08:43www.168986.cn长沙网站建设

复制代码
代码如下:

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>
IE背景半透明
</title>
<style type="text/css">
.alpha{
width: 100px;
height: 100px;
color: #fff;
background: rgba(0, 0, 0, .3);
filter: progid:DXImageTransform.Microsoft.gradient(gradientType = 0, startColorstr = #50000000, endColorstr = #50000000)\9;
}
:root .alpha{
filter: none; /for IE9/
}
</style>
</head>
<body>
<div class="alpha">
文字文字
</div>
</body>
</html>

Copyright © 2016-2025 www.168986.cn 狼蚁网络 版权所有 Power by