Discuz 论坛添加全页面底图,具体步骤如下:
方法1:通过后台修改(推荐,最简单)
- 登录 Discuz 后台
- 进入 界面 → 风格管理
- 找到你正在使用的风格,点击 编辑
- 找到 CSS 扩展 或 自定义 CSS 区域
- 添加以下代码:
body {
background-image: url('你的图片路径.jpg');
background-size: cover;
background-position: center;
background-repeat: no-repeat;
background-attachment: fixed;
}
/* 如果内容区域需要半透明背景 */
#wp, .bm, .fl, .bm_c {
background-color: rgba(255, 255, 255, 0.95) !important;
}
方法2:直接修改 CSS 文件
-
通过 FTP 或文件管理器找到文件:
template/default/common/common.css
(注意:default 可能是你使用的模板名称)
-
在文件末尾添加:
body {
background-image: url('{IMGDIR}你的图片名.jpg');
background-size: cover;
background-position: center;
background-repeat: no-repeat;
background-attachment: fixed;
}
/* 论坛内容区域半透明 */
#wp, .bm, .fl, .bm_c {
background-color: rgba(255, 255, 255, 0.95) !important;
}
- 上传图片到:
static/image/common/
方法3:使用伪元素(效果更好)
body::before {
content: '';
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-image: url('{IMGDIR}你的图片名.jpg');
background-size: cover;
background-position: center;
z-index: -1;
opacity: 0.6;
}
/* 确保内容在背景之上 */
#wp, .bm, .fl, .bm_c {
position: relative;
z-index: 1;
background-color: rgba(255, 255, 255, 0.95) !important;
}
注意事项
- 修改后需要清理缓存:后台 → 工具 → 更新缓存
- 图片路径:
{IMGDIR} 是 Discuz 的图片目录变量,会自动解析为 static/image/common/
- 透明度调整:
rgba(255, 255, 255, 0.95) 最后的数字是透明度(0-1),越小越透明
- 背景透明度:
opacity: 0.6 控制底图的透明度
推荐方案
建议用 方法1(后台修改),因为:
- 不需要 FTP 访问
- 修改后立即生效
- 方便随时调整或撤销
|