想要将 background-color
应用于嵌套在 footer
中的 div
。 footer
有一个 background-image
覆盖了我在 CSS
中设置的整个页脚。包含 img
的 div
的 background-color
应该到达 footer
的 的底部bakground-img
。这是我的意思的一个例子:
我的代码是这样的:
<footer>
<div class="some class">
<img src="img/some-image.png" alt=" ">
<div class="some class"> other content </div>
</div>
<div class="bottom-footer"> </div>
</footer>
CSS:
footer {
background-image: url('../img/footer.jpg');
background-repeat: no-repeat;
background-size: 100%;
height: 400px;
width: 100%;
}
.some.class {
width: 300px;
height: 365px;
margin-left: 2%;
background-color: (0,0,0,.97);
z-index: 1;
}
div.some img {
width: 260px;
height: 130px;
margin-top: 30px;
}
显示了 img
,但我看不到具有 img
的 div 的 background-color
。可能是一个简单的修复,但我似乎无法弄清楚。任何帮助将不胜感激。
最佳答案
您需要包含 rgba
。
background-color: rgba(0,0,0,.97);
关于css - 设置后背景颜色不可见,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34094499/