我希望每当缩放-相邻元素相应地移动。我怎样才能做到这一点?每当我缩放时,它都会放在相邻元素的顶部。
与此相反,如果我更改width
值,它可以按我的意愿工作,但是我不能width
在过渡中使用。
HTML:
<input>
<div class="foo">
CSS:
input{
display: inline-block;
transition: all 1s ease;
transform-origin:left;
}
input:focus{
transform: scaleX(2)
}
.foo{
display: inline-block;
width: 200px;
height: 20px;
background-color: red;
}
切记为转换设置初始值和目标值,如下所示:
input{
display: inline-block;
vertical-align: top;
transition: width 1s ease;
transform-origin:left;
width: 100px;
}
input:focus{
width: 200px
}
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句