我想爲我的頁面設置多個背景圖片,但我無法使用外部CSS文件,因此我不知道如果我做錯了什麼或者有什麼問題記事本++或XAMPP,因爲我的代碼似乎是功能。無法顯示背景圖片
注:
- 我使用的圖片已經全部權限打開。
- 我能夠看到圖像,如果我使用內嵌CSS,但不是當我使用 外部CSS文件。
- 我也能夠看到圖像,當我使用圖像標籤。
圖片代碼(這個工程)
<img src="img/bg1.png" alt="">
測試HTML文檔
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Test</title>
<!-- Custom Cascading Styling Sheet -->
<link rel="stylesheet" type="text/css" href="css/custom-styles.css">
</head>
<body>
</body>
</html>
外部CSS代碼:定製styles.css的
例1(這不起作用):
body {
background-image: url('img/bg1.png'), url('img/bg2.png'), url('img/bg3.png') no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
}
例2(這不起作用):
body {
background-image: url('img/bg1.png') no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
}
例3(這不起作用):
body {
background-image: url('img/bg1.png');
}
我看到了我出錯的地方。我需要上傳一個目錄才能訪問圖像目錄。謝謝! – JDFD