我的背景图片没有显示。我使用了图片链接,但没有显示。可能是什么问题
.header {
background-image: url("https://www.africa.com/wp-content/uploads/2015/07/Kenya.jpg");
background-attachment: fixed;
background-size: cover;
background-position: center;
}
.overlay{
position: absolute;
min-height: 100%;
min-width: 100%;
left: 0;
top: 0;
background: rgba(244, 244, 244, 0.79);
}

<header class="header">
<div class="overlay"></div>
</header>
&#13;
答案 0 :(得分:0)
问题是header
没有高度......这应该有效。
.header {
background-image: url("https://www.africa.com/wp-content/uploads/2015/07/Kenya.jpg");
background-attachment: fixed;
background-size: cover;
background-position: center;
height: 300px;
}
.overlay{
position: absolute;
min-height: 100%;
min-width: 100%;
left: 0;
top: 0;
background: rgba(244, 244, 244, 0.79);
}
&#13;
<header class="header">
<div class="overlay"></div>
</header>
&#13;