将文本与输入和div对齐

时间:2016-08-16 09:18:11

标签: html css html5 css3 vertical-alignment

我希望用作边框的div垂直居中。但看起来div正在上升

div going upward

<label> Application </label> <input type="text" style="width:10%; bottom:20px;">
<div style="width:1px; height:20px; background-color:grey;display: inline-block"></div> <label> Iteration </label> <input type="text" style="width:10%">

2 个答案:

答案 0 :(得分:2)

使用vertical-align: middle;垂直对齐。

&#13;
&#13;
<label> Application </label> <input type="text"  style="width:10%; bottom:20px;">  <div style="width:1px; height:20px; background-color:grey;display: inline-block;vertical-align: middle;"></div> <label> Iteration </label>  <input type="text" style="width:10%">
&#13;
&#13;
&#13;

答案 1 :(得分:0)

<label> Application </label> <input type="text"  style="width:10%; bottom:20px;">      
<div style="width:1px; height:20px; background-color:grey;margin:-5px 0px;display: inline-block"></div> 
<label> Iteration </label>  <input type="text" style="width:10%">

 <div style="width:1px; height:20px; background-color:grey;vertical-align:middle;display: inline-block"></div>