在Internet Explorer中的文本输入中垂直居中文本 [英] Vertically center text in text input in Internet Explorer

查看:106
本文介绍了在Internet Explorer中的文本输入中垂直居中文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Internet Explorer中的输入字段中遇到垂直对齐文本问题。

I am having trouble vertical aligning text in an input field in Internet Explorer.

我有:

input#search {
    float:left;
    font-size:11px;
    height:20px;
    margin:0;
    padding-left:4px;
    width:100px;
}

在Firefox和Chrome中,它似乎是自动垂直对齐,

In Firefox and Chrome, it seems to be automatically vertical aligned, however in Internet Explorer it is not.

推荐答案

只需设置输入对象的高度和行高,它工作正常(即7+ )。

Just set the height and line-height for the input object and it works fine (ie 7+).

input { border: 0; font-size: 0.8em; height: 32px; line-height: 32px;}

gl
Paulo Bueno

gl Paulo Bueno

这篇关于在Internet Explorer中的文本输入中垂直居中文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆