终于让我的主要视差图像在背景尺寸为 100% auto 的移动设备上缩放,但现在图像后有一个很大的空白空间,其中 div 没有按比例缩小到移动设备尺寸。请帮忙!这是 site .
css
.bcg {
background-position: center center;
background-repeat: no-repeat;
background-attachment: fixed;
background-size: 100% auto;
height: 100%;
width: 100%;
}
.hsContainer {
display: table;
table-layout: fixed;
width: 100%;
height: 100%;
overflow: hidden;
position: relative;
}
.hsContent {
max-width: 450px;
margin: -150px auto 0 auto;
display: table-cell;
vertical-align: middle;
color: #ebebeb;
padding: 0 8%;
text-align: center
}
最佳答案
背景附件:已修复;移动浏览器往往不支持。根据我的经验,它往往会导致一些不良行为。
这可能有帮助:Background-attachment: fixed not working on android/mobile
此外:我认为 p 标签导致了您的问题。检查元素显示 P 标签的高度约为 20-30px。但里面没有内容。
关于css - 视差主图像 div 高度不会在移动设备上缩放,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29883918/