0
我的问题与我在互联网上发现的其他问题有点不同。我有两个列布局,每个都有50%,我有我的标签和输入字段。问题在于标签的文字,有时很长,有时只是一个字。我尝试了一切,但我无法让文本垂直居中对齐。我曾尝试过的东西line-height vertically-align display
垂直对齐标签和文本框
我的问题与我在互联网上发现的其他问题有点不同。我有两个列布局,每个都有50%,我有我的标签和输入字段。问题在于标签的文字,有时很长,有时只是一个字。我尝试了一切,但我无法让文本垂直居中对齐。我曾尝试过的东西line-height vertically-align display
垂直对齐标签和文本框
显示:内嵌块声明并不完全支持IE7及以下版本,所以你必须使用display:inline代替zoom:1 hasLayout hack模仿声明攻击目标IE7。要对齐两个文本框和labelwe可以使用垂直对齐:中间属性,就像这样:
CSS
input.textBox {
margin-top: 5px;
margin-bottom: 5px;
height: 30px;
width: 350px;
font-size: 15px;
font-family: Verdana;
line-height: 30px;
display:inline-block;
*display: inline; /* for IE7*/
zoom:1; /* for IE7*/
vertical-align:middle;
}
label.inputLabel {
font-family: Verdana;
font-size: 15px;
line-height: 30px;
display:inline-block;
*display: inline; /* for IE7*/
zoom:1; /* for IE7*/
}
粘贴代码 – DevelopmentIsMyPassion
'显示:表cell'是做的最好方法垂直对齐工作 – Pete