iOS 5.0 Safari在文本框中不垂直居中占位符 [英] iOS 5.0 Safari not vertically centering placeholder in text box

查看:843
本文介绍了iOS 5.0 Safari在文本框中不垂直居中占位符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在页面上输入文本框中输入的文本垂直居中。

I want to vertically center the text entered in input text boxes on the page.

实现这一点的典型方法是将line-height和height设置为相等。这在iOS 5.0 Safari之前。

Typical way to achieve this is to set the line-height and height equal. This works on pre iOS 5.0 Safari.

但是;在iOS 5上,Safari显示垂直居中的类型文本...但是占位符文本和光标显示在顶部对齐。

However; on iOS 5, Safari displays the typed text vertically centered... But the placeholder text and the cursor appear top aligned.

.txtBox {
    line-height: 3em;
    height: 3em;
}

< input type =textclass = txtBoxplaceholder =Name>< / input>

任何人遇到此问题?

推荐答案

设置 line-height:1; 似乎可以解决这个问题。

Setting line-height: 1; seems to fix this.

这篇关于iOS 5.0 Safari在文本框中不垂直居中占位符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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