【发布时间】:2021-12-13 02:10:24
【问题描述】:
.c{
display: flex;
padding-top: 18em;
.backgroundDiv{
background: url("/images/DSC8253.png");
background-repeat: no-repeat;
background-size: cover;
background-position: center center ;
height: 20em;
opacity: 0.6;
position: absolute;
width: 100%;
z-index: -1;
}
}
.bigText{
display: flex;
text-transform: uppercase;
font-size: 3em;
font-family: cursive;
font-weight: 600;
height: 8em;
top:2em;
}
<section class="c">
<div class="backgroundDiv"></div>
<div class="bigText">
<p>Pilki-HUILKI</p>
</div>
</section>
【问题讨论】:
-
您是否尝试过使用 rbga() 颜色作为 bg 而不是不透明度? Opacity 会改变 div 中文本的不透明度,rbga() 只会改变背景。
-
@NathanielFlick 这适用于背景图片吗?您的意思是应该使用 rgba() 值设置哪个属性?
-
您是否使用了预处理器,因为它看起来不像 CSS。但是,当我将其设为 CSS 时,文本在图像上方就可以了。你能描述一下你想要的结果吗?
-
rgba 将为 colot 设置不透明度它应该如何处理图像?我用 sass 是的。有一个带有完整代码 atm 的 git 文件夹
-
@Corrl 哎呀我忘了那里有图像,而不是颜色。