如何垂直对齐IE输入框上的文本 [英] How to vertical-align text on this input box for IE
本文介绍了如何垂直对齐IE输入框上的文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有此代码:
< input type =textclass =contactInputvalue =my string>
.contactInput
{
border:0;
margin:0;
padding:0;
background-color:#000000;
color:#ffffff;
height:22px;
width:290px;
padding-left:5px;
}
,我想垂直对齐它。 Firefox和Chrome会自动执行(如IE9)。
解决方案
假设您的意思是在中心垂直对齐,您可以使用 line-height
CSS属性来执行此操作。只需将其设置为与元素的 height
相同。
I have this code :
<input type="text" class="contactInput" value="my string">
.contactInput
{
border:0;
margin:0;
padding:0;
background-color:#000000;
color:#ffffff;
height:22px;
width:290px;
padding-left:5px;
}
and I'd like to vertical-align it. Firefox and Chrome do it automatically (as IE9). With IE8 or 7 is in the top.
How can I do it with CSS?
解决方案
Assuming you mean vertically align in the centre, you can use the line-height
CSS property to do this. Simply set it to be the same as the height
of the element.
这篇关于如何垂直对齐IE输入框上的文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文