簡體   English   中英

菜鳥,CSS 背景圖不顯示? 請幫忙?

[英]Newbie! CSS Background image not displaying, help please?

我試圖在背景中放置一個圖像,在一個大 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");

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM