背景封面和百分比宽度执行作业缩放和对齐图像的情况视口比16/9更水平。对于屏幕高度超过0.5625宽度的情况,外部布局部分开始吃中心。在这种情况下,从左侧和右侧进行裁剪可能更好,或者可以在顶部和底部添加空白条。
请提供您已知的最佳做法。 非常感谢您的参与,和平,ayo。
<div class="bg">
</div>
<div class="column" id="column_left">
</div>
<div class="column" id="column_center">
</div>
<div class="column" id="column_right">
</div>
的CSS:
bg {
position: relative;
overflow: hidden;
height: 100%;
width: 100%;
max-width: 1920px;
background: url(images/1920/bg.png) no-repeat center 0 /cover;
}
.column {
max-width: 100%;
opacity: 0;
display: block;
-webkit-transition: opacity 0.5s ease-in-out;
-moz-transition: opacity 0.5s ease-in-out;
transition: opacity 0.5s ease-in-out;
position: absolute;
height: 100%;
&:hover {
opacity: 1;
cursor: pointer;
}
}
#column_left {
float: left;
left: 0;
width: 38.85%;
background: url(images/1920/left.png) no-repeat 0 0 /cover;
}
#column_center {
float: left;
left: 0;
right: 0;
margin-left: 26.17%;
width: 44.69%;
background: url(images/1920/center.png) no-repeat center 0 /cover;
}
#column_right {
float: right;
right: 0;
width: 39.58%;
background: url(images/1920/right.png) no-repeat 100% 0 /cover;
}
答案 0 :(得分:0)
你能说清楚你想要实现的目标吗?从我能掌握的内容来看,你可能想要从封面改为背景大小?
background: url(images/1920/left.png) no-repeat 0 0 /cover;
到
background: url(images/1920/left.png) no-repeat 0 0;
background-size: contain;