我无法在html div中获取背景图片url是正确的所有语法都是正确的。
HTML
<div class="img-container"></div>
CSS
.img-container {
background-image: url("../img/photosm.jpg");
}
你可以测试两件事之一,
.img-container {
background-image: url("../img/photosm.jpg");
background-repeat: no-repeat;
background-position: center;
background-size: cover;
height: 20rem;
width: 30rem;
}