我试图加载背景图像,所以我使用的CSS背景图像的URL,但它不工作,这意味着它是不加载。
.home {
display: flex;
align-items: center;
min-height: 100vh;
background-image: url(../wordpress/img/online-training.jpg);
background-size: cover;
background-position: center;
}
<section class="home" id="home">
<div class="content">
<span>Take The Right Step <br>For Your Business</span>
<p>Tax associate is a leading consultancy firm that provides simple, effective company registration and accounting solutions to enterprises in ireland</p>
<a href="#" class="btn">Get Started</a>
</div>
</section>
2条答案
按热度按时间vhipe2zx1#
URL可能不正确。尝试使用完整的URL,看看它是否加载例如。
https://website.com/wordpress/img/online-training.jpg
。如果这样做有效,那么您使用的相对URL语法可能需要调整,例如:/wordpress/img/online-training.jpg
。它将工作没有报价,但它的更好地有他们在下面的建议。
00jrzges2#
您的css在background-image的URL中缺少双引号:
CSS:
background-image: url("../wordpress/img/online-training.jpg");
此外,您应该检查文件的路径。