CSS背景图像未按预期显示



我试图在背景中放置一个图像,在大div的两端。

CSS代码:
}
.headall {
background-color: #44546a;
/*width: 100%;*/
/*top: 0 !important;*/
}
.headl {
width: 12%;
float: left;
/*display: table-cell;*/
justify-content: right;
transform: scaleX(-1);
background-image: url(./images/leaves.png);
background-repeat: no-repeat;
background-size: 130px;

}
.headctr {
width: 76%;
display: inline-block;
justify-content: center;
}
.headr {
width: 12%;
float: right;
display: table-cell;
justify-content: right;
background-image: url(./images/leaves.png);
background-repeat: no-repeat;
background-size: 130px;
}

但是,图像将不显示。

将图像放在主文件中,可以工作,但它会将其放在前台....

你需要加引号。如果你的图像文件和css文件不在同一个文件夹中,你需要两个点。

background-image: url("../images/leaves.png");

最新更新