如何设置div不透明度而不是文本?

Rub*_*min 4 html css opacity

我只想对 div 使用不透明度,而不是在文本上。我对 div 不透明度使用了一些代码,但它也显示了文本不透明度。我不想显示文本不透明度。我的代码在这里。

.opabenner {
width:569px;
height:100px;
float:left;
position:absolute;
background:#06F;
top:587px;
filter:alpha(opacity=60); /* IE */
   -moz-opacity:0.6; /* Mozilla */
   opacity: 0.6; /* CSS3 */
z-index:9999;
  }
 .tit {
position: absolute;
font-size: 20px;
color: #FFF;
text-align: center;
padding: 5px;
width: 580px;
  }


  <div class="opabenner"> 
         <h1 class="tit">Step inside love in 2014 and join today for FREE!</h1>
    </div>
Run Code Online (Sandbox Code Playgroud)

Kar*_* RK 8

使用background: rgba(0,0,0,.5);删除opacity: 0.6;

示例演示


Nab*_*imi 0

对容器使用 RGBA 颜色

p{
    color: red;
}

#transparent{
    background-color: rgba(0, 0, 0, .1); /* 0.1 alpha = 10% opacity */
}
Run Code Online (Sandbox Code Playgroud)

预览: http: //jsfiddle.net/EfDZC/