首页 > 开发 > CSS > 正文

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

2024-07-11 08:28:36
字体:
来源:转载
供稿:网友

复制代码
代码如下:
<!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>
发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表