div中input垂直居中的方法
1. absolute+transfrom
<div>
<input type="text"/>
</div>
<style>
div{
position: relative;
height: 44px;
background-color: #fe3c35;
}
input{
position: absolute;
top: 50%;
transform: translateY(-50%);
height: 30px;
background-color: #FFFFFF;
}
</style>
2. absolute+margin
<div>
<input type="text"/>
</div>
<style>
div{
position: relative;
height: 44px;
background-color: #fe3c35;
}
input{
position: absolute;
top: 0;
bottom: 0;
margin: auto 0;
height: 30px;
width: 80%;
background-color: #FFFFFF;
}
</style>