我一直在嘗試在 CSS 中添加我的背景圖片,但沒有任何效果。我嘗試了一些 YouTube 視頻,但一無所獲。有人可以幫我嗎?我的主檔案夾中有一個名為“Image”的檔案夾,名為“CSS_animation”,僅用于背景關系。
HTML
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<link href="style.css" rel="stylesheet" type="text/css"/>
<title>CSS Animation</title>
</head>
<body>
<main>
<nav>
<ul>
<li class="one"><a href="#">Menu 1</a></li>
<li class="two"><a href="#">Menu 2</a></li>
<li class="three"><a href="#">Menu 3</a></li>
</ul>
</nav>
</main>
</body>
</html>
CSS
body
{
background-image: url("Image/FreshFarmsBG.jpg");
}
uj5u.com熱心網友回復:
我不確定,但檢查 url 可能是“./image/FreshFarmsBG.jpg”(帶有小 i),或者只是嘗試在 css 中添加它
background-repeat: no-repeat;
background-size: cover;
uj5u.com熱心網友回復:
首先在 HTML 檔案中使用<style>標簽中的<head>標簽對其進行測驗,然后將您的 CSS 插入到樣式標簽中...
<head>
<style>
body {
background-image: url("desiredPathHere");
}
</style>
</head>
如果這有效,那么您創建的樣式表鏈接可能不正確......
轉載請註明出處,本文鏈接:https://www.uj5u.com/net/371863.html
上一篇:單擊時重置所有按鈕狀態
