您的位置:首页 > Web前端 > CSS

css样式让input垂直居中

2020-02-03 04:47 1001 查看

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>

  

转载于:https://www.cnblogs.com/cnsevennight/p/4349968.html

  • 点赞
  • 收藏
  • 分享
  • 文章举报
anba7411 发布了0 篇原创文章 · 获赞 0 · 访问量 490 私信 关注
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: