css样式让input垂直居中

css代码:

.div1{
border: 1px solid #CCC;
width:1120px;
height:40px;
margin:auto;
display: table;
*position: relative;
overflow: hidden;
}
.div2 {
vertical-align: middle;
display: table-cell;
*position: absolute;
*top: 50%;
}
.div3 {
*position: relative;
*top: -50%;
float:right;
padding-right:10px;
}

html代码:

<div class="div1">
    <div class="div2">
        <div class="div3">
            <input type="text" size="30">
        </div>
    </div>
</div>

  

相关文章:

  • 2021-12-04
  • 2021-12-04
  • 2021-04-23
  • 2021-08-05
  • 2021-06-08
  • 2021-11-24
猜你喜欢
  • 2022-03-10
  • 2021-05-26
  • 2022-01-24
  • 2021-12-31
  • 2021-10-02
  • 2021-11-15
  • 2021-10-12
相关资源
相似解决方案