【发布时间】:2017-01-03 03:44:37
【问题描述】:
编辑:: 已解决,而不是使用变换,更改背景大小有效,谢谢大家。
我正在尝试转换其中一个 div 的比例,同时保持最大宽度,例如缩放效果,但是它忽略了最大宽度?
.Img2 {
position: relative;
height: 300px;
display: inline-block;
width: 400px;
float: left;
padding: 0;
cursor: pointer;
}
.box2 {
height: 300px;
max-width: 400px;
width: 400px;
display: inline-block;
background-size: contain;
background-position: center;
background-color: black;
}
.box2:hover {
transform: scale(1.03);
}
<li class="Img2">
<div class="box2"></div>
</li>
【问题讨论】:
-
感谢您修复格式,我不知道如何创建 sn-ps。