<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'>
<html xmlns='http://www.w3.org/1999/xhtml'>
<head>
<meta http-equiv='Content-Type' content='text/html; charset=utf-8' />
<title>兼容所有浏览器背景半透明文字不透明</title>
<head>
<style >
* {margin:0;padding:0;}
.Boxer {width:600px;height:400px;overflow:hidden;margin:0 auto;border:6px solid red; background:#000}
.Opacity {
height:400px;
background-color:rgba(255,0,0,0.5);
_background-color:#f00; /*IE6 系列*/
*background-color:#f00; /*IE7 系列*/
filter:alpha(opacity=50);
}
.BoxerInner {position:relative; /*IE 系列*/text-align:center;font-size:24px;font-weight:700;}
</style>
<!--[if IE 8]>
<style type="text/css">
.Opacity {background-color:#f00;
<![endif]-->
<!--[if IE 9]>
<style>
.Opacity {background-color:#f00;
filter:alpha(opacity=50); }
</style>
<![endif]-->
</head>
<body >
<div class="Boxer">
<div class="Opacity">
<span class="BoxerInner">BoxerInner</span>
</div>
</div>
</body>
</html>
<html xmlns='http://www.w3.org/1999/xhtml'>
<head>
<meta http-equiv='Content-Type' content='text/html; charset=utf-8' />
<title>兼容所有浏览器背景半透明文字不透明</title>
<head>
<style >
* {margin:0;padding:0;}
.Boxer {width:600px;height:400px;overflow:hidden;margin:0 auto;border:6px solid red; background:#000}
.Opacity {
height:400px;
background-color:rgba(255,0,0,0.5);
_background-color:#f00; /*IE6 系列*/
*background-color:#f00; /*IE7 系列*/
filter:alpha(opacity=50);
}
.BoxerInner {position:relative; /*IE 系列*/text-align:center;font-size:24px;font-weight:700;}
</style>
<!--[if IE 8]>
<style type="text/css">
.Opacity {background-color:#f00;
filter:alpha(opacity=50);
}
</style><![endif]-->
<!--[if IE 9]>
<style>
.Opacity {background-color:#f00;
filter:alpha(opacity=50); }
</style>
<![endif]-->
</head>
<body >
<div class="Boxer">
<div class="Opacity">
<span class="BoxerInner">BoxerInner</span>
</div>
</div>
</body>
</html>