我需要創建一個可以在單個文件中打開並運行的小型網站。我無法弄清楚如何獲得圖像背景。我的形象是Desktop/assignment/Website-Background.jpg
。我嘗試了很多不同的方式來使它工作,但它只是不會。我當前的代碼是:背景問題
body{
height: 100%;
}
.bg {
background-image: url("Website-Background.jpg");
height: 100%;
background-position: center;
background-repeat: no-repeat;
background-size: cover;
}
而且我已經試過也試着
body {
background-image: url("Website-Background.jpg");
}
有人能指出我在做什麼錯?
並且圖像與.html文件位於相同的文件夾中? – LiefdeWen
「Website-Background.jpg」在哪裏存儲? –
只是'background-image:url(「Desktop/assignment/Website-Background.jpg」);'? –