Bootstrap 3为缩略图背景添加不透明度

时间:2016-02-05 10:33:06

标签: css3 twitter-bootstrap-3 opacity

我正在尝试在bootstrap中为缩略图类添加不透明度,但我只想在背景颜色上使用不透明度而不是在部分中的其他文本。如果我使用:

.thumbnail {
opacity: 0.6;
}

这适应孔内容,我试图段落标签不使用此不透明度。 TNX,P

<div class="col-sm-6 col-md-3">
    <div class="thumbnail">
      <img src="img/box/1.jpg" alt="...">
      <div class="caption">
        <h3 >Test</h3>
        <p >
Testtt
        </p>
        <p><a href="#" >Link</a></p>
      </div>
    </div>
  </div>

1 个答案:

答案 0 :(得分:1)

图像是缩略图的完整背景,然后只需使用:

.thumbnail > img {
    opacity: 0.6;
}

如果您在缩略图上使用背景样式,请使用:

.thumbnail {
    background-color: rgba(0, 0, 0, 0.6);
}