我想使用濾鏡:亮度將div的背景圖像變暗。它運作良好,但顯然它會使整個div變暗,而不僅僅是圖像。我如何才能使用CSS變暗背景圖像?我想有一些白色的文字。背景:網址和濾鏡:亮度
這裏是我的代碼:
#about_header {
background: url(../img/background/spa_02.jpg) no-repeat center center fixed;
filter: brightness(20%);
-webkit-filter: brightness(20%);
-moz-filter: brightness(20%);
-o-filter: brightness(20%);
-ms-filter: brightness(20%);
height:400px;
display: table;
position: relative;
width: 100%;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
}
#about_header h1{
color: white;
}
<section id="about_header">
<div class="container text-vcenter">
<div class="row">
<div class="col-sm-12">
<div>
<h1>Contact us</h1>
</div>
</div>
</div>
</div>
</section>
使用2個獨立的'div's,一個與背景和規模的父母,對方只包含的內容和延伸填補父母。 –
我不明白,你能告訴我編輯我的代碼嗎?那麼,過濾器應該在哪裏? – Ishiru