0
终于得到我的主视差图像在背景大小:100%自动,但现在有一个很大的空白空间在div不缩放降至手机大小。请帮忙!这是site。视差主图像的div高度将不会在移动设备上缩放
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-size:cover'应该在这种情况下效果更好... – Shikkediel
我使用的是背景大小:封面,但图像的可笑程度非常大。有没有简单的方法来使分组响应? –
您可以使用媒体查询为肖像或风景包含不同的背景图像。如果图像比率是固定的,我不知道如何在调整窗口大小时显示水平*或垂直中间。 – Shikkediel