我只是想在我的網站上更改我的背景圖片。我可以更改背景顏色,但不能更改影像。這是我第一次使用 php,所以我不知道我是否應該知道一些東西。剛剛使用 HTML/CSS/JS。感謝幫助!
樣式.css
body{
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
background-image: url("/img/indexbackground.png");
}
索引.php:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Quickbuy</title>
<link rel="stylesheet" href="css/reset.css">
<link rel="stylesheet" href="css/style.css">
</head>
uj5u.com熱心網友回復:
問題是您沒有將 CSS 放在樣式標簽中。
你也沒有包括</html>. 這不會影響這個問題,但是它可能會導致更復雜的網頁和舊瀏覽器出現問題。
這是更新的代碼,在一個片段中:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Quickbuy</title>
<link rel="stylesheet" href="css/reset.css">
<link rel="stylesheet" href="css/style.css">
<style>
body {
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
background-image: url("/img/indexbackground.png");
background-color: #22d; /*Background color is being used to replace background image, remove it in your code.*/
}
</style>
</head>
</html>
CSS不能只是這樣
element {
color: red;
}
<!DOCTYPE html>
...
它必須在樣式標簽中。
<!DOCTYPE html>
<html>
<head>
<style>
element {
color: red;
}
</style>
</head>
<body>
...
</body>
</html>
uj5u.com熱心網友回復:
試試這個:
<style type="text/css">
body{
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
background-image: url("/img/indexbackground.png");
}
</style>
否則您的鏈接中可能存在一些語法問題。并且不要忘記在更改代碼后保存代碼。
轉載請註明出處,本文鏈接:https://www.uj5u.com/ruanti/475281.html
