css - 如何在手机和桌面上制作固定的整页背景图片?WordPress - Divi - CSS
问题描述
所以我正在为 WordPress 开发 Divi 网站。
我添加了 CSS 代码,允许我在主页上设置固定的背景图像,但是,在平板电脑和移动设备视图上,图像不会覆盖整个屏幕,页面的一半是白色的。有什么方法可以将固定图像也设置为在移动设备上全屏显示?
这是我得到的代码:
.select_page {
visibility: hidden;
}
span.mobile_menu_bar:before {
color: rgba(201,144,0,0.78) !important;
}
.et_mobile_menu {
border-top: 3px solid rgba(201,144,0,0.78);
}
/* First we have to make the main header transparent */
#main-header {
background-color: transparent;
}
#main-header,
#main-header.et-fixed-header {
background-color: transparent;
}
/* Then we turn off the footer */
#main-footer {
background-color: transparent !important;
}
/* Here we make the content of our page builder sections transparent. This is so that the background image shows through */
.et_pb_section {
background-color: transparent;
}
/* Here we set the background image for our specific pages. We also set the background image to cover so that it always fills the screen */
.page-id-15 {
background-image: url("https://ardakarakaya.com/wp-content/uploads/2019/12/ARDA1-1.jpg");
background-size: cover;
}
header#main-header.et-fixed-header, #main-header {
-webkit-box-shadow: none !important;
-moz-box-shadow: none !important;
box-shadow: none !important;
}
网站:ardakarakaya.com
亲切的问候
担
解决方案
这个CSS需要改变:
body.custom-background {
...
background-attachment: fixed;
}
推荐阅读
- ansible - 无法使用 ansible 创建 gitlab 项目
- jquery - 文档准备就绪时窗口不会滚动到底部
- java - 评分栏 - 如何?
- reactjs - Reactjs 内存泄漏 - 内联函数与绑定柯里化函数
- django - Django prefetch_related 与反向外键查找
- python-3.x - 在表格子图之间添加标题和空格
- azure - 如何在 Azure 机器学习中使用历史数据集进行训练和预期数据集作为预测的输入
- swift - 标签不调整字体大小以适应宽度
- python - 配置文件中带有空格的python文件路径
- android - 我可以在真实设备中切换到 webview 但无法在模拟器上切换到 webview。使用的 Appium 版本是 1.7.2