css样式让input垂直居中


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>

  


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM