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

标签 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>

最佳答案

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

Sample Demo

关于html - 我如何设置 div 不透明度而不是文本?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21424525/

相关文章:

javascript - iframe onclick 事件改变不透明度

java - Swing HTML 绘制字符串

html - 将 html 标签添加到 json 字符串

html - 优化阴影渲染

iphone - 为 iPhone 设计 <select> 标签

javascript - 悬停在 CSS opacity 兄弟子元素中

javascript - 如何管理、加速和预加载页面上的所有图像?

javascript - 为什么在执行 Javascript 时没有触发浏览器的重排?

html - 使用 bootstrap row 和 col 的推拉在网页上订购内容

animation - SVG动画不透明度循环