【发布时间】:2018-02-27 15:07:20
【问题描述】:
所以,我有一个img 徽标,覆盖在div 样式与background-image: url("...") 上,两个元素都在2 div 内,分别具有.to-color 和.to-overlay 类,以获得黑色透明覆盖。
有没有办法从这两个类给出的样式中排除徽标?
这是一个 JSFiddle 示例:Link
示例中的 HTML 和 CSS:
- HTML -
<div class="to-color">
<div class="to-overlay">
<div class="respo">
<div class="row">
<div class="col-xs-4 col-xs-offset-4 text-center">
<img src="http://ansonalex.com/wp-content/uploads/2011/06/google-logo-768x260.png" alt="..." class="img-responsive">
</div>
</div>
</div>
</div>
</div>
- CSS -
.to-color {
background-color: #000;
}
.to-overlay {
opacity : 0.5;
}
.respo {
background-image: url("https://source.unsplash.com/category/objects/1600x900");
background-position: center center;
background-size: cover;
padding-top: 10%;
padding-bottom: 20%;
}
【问题讨论】:
-
你必须给 logo 一个 css 类,然后你必须从那里明确地重置 bg 颜色和不透明度。 css 继承是一种痛苦......
-
您可以更改标记吗?
标签: html css twitter-bootstrap