Dreamweaver (DW) 設置網頁背景圖片有「頁面屬性」圖形化操作與 CSS 代碼控制兩種方式。本文詳解菜單欄「修改」→「頁面屬性」→「外觀」→「瀏覽選圖」的可視化流程,並補充 CSS 進階屬性(平鋪/定位/固定/漸變疊加)。
在 DW 中打開需設置背景的 HTML 頁面(如 index.html)。


菜單欄「修改」→「頁面屬性」→ 左側分類選「外觀(Appearance)」。

「背景圖片」欄點擊「瀏覽」→ 選擇站點目錄下的圖片文件(建議放在 images/ 資料夾) → 確定。




返回設計視圖/即時預覽,背景圖片已顯示。

在 CSS 面板/代碼視圖為 body 或容器添加:
body {
background-image: url('../images/bg.jpg');
background-repeat: no-repeat; /* 不平鋪 */
background-position: center top; /* 置中頂部 */
background-attachment: fixed; /* 固定不隨滾動 */
background-size: cover; /* 覆蓋全屏,保持比例 */
background-color: #f0f0f0; /* 兜底色 */
}
/* 漸變疊加背景圖 */
.hero {
background: linear-gradient(rgba(0,0,0,0.5), rgba(0,0,0,0.5)),
url('hero-bg.jpg') center/cover no-repeat fixed;
}
<img>相關資源: