2
我基本上是試圖建立這樣的:如何設置背景不透明度不影響文字
添加背景圖像的父容器,那麼需要一個子容器是透明的。
這裏我的HTML:
<div class="scent-brand-contact">
<div class="scent-brand-container">
<section id="black-studio-tinymce-8" class="widget-1 widget-first widget-odd widget widget_black_studio_tinymce">
<div class="textwidget">
<p>All our fragrances are developed in compliance with the International Fragrance Association ensuring strict adherence to safety purity and manufacturing standards.</p>
<p>LEARN MORE ABOUT HOW SCENT BRANDING CAN BENEFIT YOUR BUSINESS</p>
</div>
</section>
<section id="text-4" class="widget-2 widget-last widget-even widget widget_text">
<div class="textwidget">
<button type="button">contact us today</button>
</div>
</section>
</div>
</div>
而CSS:
.scent-brand-contact{
position:relative;
background-image: url(images/lemon.jpg);
background-position: center center;
background-attachment: fixed;
background-size: cover;
min-height:380px;
}
.scent-brand-container {
background-color: #fff9c0;
padding: 10px;
opacity: 0.7;
padding-top: 5%;
margin: auto;
position: absolute;
top: 12%;
width: 100%;
min-height: 285px;
}
目前,它的發生,按鈕和文本也越來越不透明。 如何在不影響文本和按鈕的情況下獲得透明背景?
使用'RGBA()'顏色,而不是'#hex'。 – Aziz