作者热门文章
- c - 在位数组中找到第一个零
- linux - Unix 显示有关匹配两种模式之一的文件的信息
- 正则表达式替换多个文件
- linux - 隐藏来自 xtrace 的命令
我有this代码:
<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;
}
我想垂直对齐它。 Firefox 和 Chrome 会自动执行此操作(如 IE9)。使用 IE8 或 7 在顶部。
如何使用 CSS 实现?
最佳答案
假设您的意思是垂直居中对齐,您可以使用 line-height
CSS 属性来做到这一点。只需将其设置为与元素的 height
相同即可。
关于html - 如何在 IE 的输入框上垂直对齐文本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6412696/
我是一名优秀的程序员,十分优秀!