div+css如何实现背景半透明内容不透明

来源:百度知道 编辑:UC知道 时间:2024/06/06 15:48:44
如题

DIV内的不只是文字,还有DIV在里边

有效追加分

css滤镜只对IE有效,也够了

放个半透明的图片做背景不就可以了

是不背景要在字上面,主相对盖的绝对,用z-index试下。

你说的是背景透明,不能用filter(滤镜)做,只能用一张半透明的图片做为div的背景图片。

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
<style type="text/css">
body { background:#000000;}
#a { background:#FFFFFF; width:200px; height:200px; border:1px solid #000099; background:#0066FF; filter:alpha(opacity=50);}
</style>
</head>

<body>
<div id="a"><span style="position:relative;color:yellow">ddddddddddd</span></div>
</body>
</html>
加上背景图片效果一样
是你想要的吗 ?