让div透明 而里面的文字不透明的写法

<!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=gb2312" />
<title>让div透明 而里面的文字不透明的写法</title>
<style type="text/css">
<!--
body {
background-color: #990000;
color: #FFFFFF;
}
#w {
height: 200px;
width: 300px;
margin-right: auto;
margin-left: auto;
filter:alpha(opacity=50);
background-color: #003366;
}
#top{position:relative;}
-->
</style>
</head>
<body>
dan
<div id="w">
    <div id="top">透明度50%china<font color="black">透明度50% </font></div>
</div>
</body>
</html>

附:

div透明 而里面的文字也透明的写法:

<!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=gb2312" />
<title>让div透明 里面的文字透明</title>
<style type="text/css">
<!--
body {
background-color: #990000;
color: #FFFFFF;
}
#w {
height: 200px;
width: 300px;
margin-right: auto;
margin-left: auto;
filter:alpha(opacity=50);
background-color: #003366;
}
-->
</style>
</head>
<body>
dan
<div id="w">
    <div id="top">透明度50%china<font color="black">透明度50% </font></div>
</div>
</body>
</html>

里面只差了一个css类, 自己比较一下就知道了!!

posted on 2010-05-05 10:48  carekee  阅读(928)  评论(0编辑  收藏  举报