【发布时间】:2018-09-01 17:47:24
【问题描述】:
我想要实现的目标听起来很简单,但我无法让它发挥作用。
我正在尝试在image 顶部添加opacity,以便< h1 > 标记更易于阅读。
这是我的 HTML:
<header>
<section>
<div class="img_content">
<div class="bg_img" style="background-image: url('path-to-image');" >
<div class="container">
<h1 class="content_h1">Most Popular Lunches: Week 11</h1>
</div>
</div>
</div>
</section>
</header>
这是 CSS:
/*Custom CSS */
.img_content {
/* background: url(); */
background-repeat: no-repeat;
background-size: cover;
}
header section{
padding:0;
}
@media screen and (max-width: 768px){
.content_h1 {
font-size: 40px;
padding: 21% 0;
color: white;
font-size: 14px;
}
.section_details {
padding: 8% 0 19% 8%;
font-size: 14px;
}
}
section {
padding: 10px 0;
}
.bg_img {
background: #221f1f73;
}
.content_h1 {
font-size: 85px;
padding: 14% 0;
color: white;
}
.section_details {
padding: 4% 0 0 0;
font-size: 14px;
}
我认为问题可能是-Z index 或类似的东西?
【问题讨论】:
-
你想在h1还是bg_img上设置不透明度?
-
bg_img 请!
-
你能检查一下,看看你是否可以解决类似的问题:stackoverflow.com/questions/49333122/css-border-confusion/…