gpt4 book ai didi

html - 在我的 CSS 中,背景大小属性无法正常工作,即使我在 bg img 之后设置?

转载 作者:行者123 更新时间:2023-11-28 15:39:26 24 4
gpt4 key购买 nike

在下面的代码中,我为该部分提供了一个类,并在 css 表中使用了该类,但是背景图像没有覆盖整个部分,它只覆盖了该部分的 25%。我的图像大小是 3000 x 2000。

.section-testimonials {
background-image: linear-gradient(rgba(0, 0, 0, 0.8), rgba(0, 0, 0, 0.8)), url(img/back-customers.jpg);
color: #fff;
background-attachment: fixed;
background-size: cover;
}
<section class="section-testimonials">
<div class="row">
<h2>Our customers can't live without us</h2>
</div>
<div class="row>">
<div class="col span-1-of-3">
<blockquote>
Omnifood is just awesome! I just launched a startup which leaves me with no time for cooking, so Omnifood is a life-saver. Now that I got used to it, I couldn't live without my daily meals!
<cite>
<img src="https://techmadeplain.com/img/2014/3000x2000.png">Alberto Duncan
</cite>
</blockquote>
</div>
</div>
</section>

最佳答案

你可以试试这个..我希望它会起作用

.section-testimonials {
background-image: linear-gradient(rgba(0, 0, 0, 0.8), rgba(0, 0, 0, 0.8)), url(img/back-customers.jpg);
color: #fff;
background-attachment: fixed;
background-size: 100%;
position: absolute;
}
<section class="section-testimonials">
<div class="row">
<h2>Our customers can't live without us</h2>
</div>
<div class="row>">
<div class="col span-1-of-3">
<blockquote>
Omnifood is just awesome! I just launched a startup which leaves me with no time for cooking, so Omnifood is a life-saver. Now that I got used to it, I couldn't live without my daily meals!
<cite>
<img src="https://techmadeplain.com/img/2014/3000x2000.png">Alberto Duncan
</cite>
</blockquote>
</div>
</div>
</section>

关于html - 在我的 CSS 中,背景大小属性无法正常工作,即使我在 bg img 之后设置?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50718795/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com