IE6和IE7输入填充CSS

Pod*_*lsk 3 css forms internet-explorer

我有高度为25像素的输入框.在Firefox中,Safari和IE8会自动垂直对齐中间的文本.但是在IE6和IE7中,文本与顶部对齐.

我怎么解决这个问题?添加padding-top会增加输入的总高度,因为我已经明确地声明了它的高度.

我不希望使用浏览器特定的CSS.

谢谢.

jer*_*ans 6

最简单的解决方法是使用行高值

input[type=text] { border: 1px solid #dbdbdb; height: 28px; line-height: 25px; }


Mat*_*ley 5

相关问题:Chrome会做同样的事情.

解决方法:减少heightx像素并增加padding-topx像素.

例如.

input { 
    height: 15px; /* roughly 1.2 times font-size, or equal to line-height if set */
    padding: 5px 0; /* add padding to top and bottom to pad out the height to required height */
}
Run Code Online (Sandbox Code Playgroud)