【发布时间】:2019-11-23 12:46:30
【问题描述】:
在我创建的 ID 内的图像上放置过滤器时,背景和文本都会被过滤,而我的目的只是降低背景的亮度
我尝试过制作单独的类和 ID,但没有任何效果符合我的要求。
HTML
<section id="showcase">
<div class="container">
<h1>Hello</h1>
<p>I need to type something in here</p>
</div>
</section>
CSS
#showcase{
min-height: 400px;
background:url('../img/writing-code33.jpg');
filter: brightness(20%);
background-size: cover;
text-align: center;
color: #ffffff;
}
/*#showcase background{
filter: brightness(20%);
}*/
#showcase h1{
margin-top: 100px;
font-size: 55px;
margin-bottom: 10px;
}
【问题讨论】:
-
我会将
. container放在#showcase之外,并将两者都包装在一个div 中——例如。接下来我将.container绝对定位在#showcase