Webkit中的HTML5,占位符,行高

Webkit中的HTML5,占位符,行高

问题描述:

我有一个输入字段:

<input type="text" placeholder="whatever">

带样式:

input {
    margin: 0;
    padding: 0 6px;
    font-size: 19px;
    line-height: 19px;
    height: 36px;
    width: 255px;
}

问题是,在webkit中,行高不对占位符生效。所以输入字段中的文本以丑陋的方式对齐。其他人看过这个以及现在该如何修复它?

Problem is the line-height is not taking effect for the placeholder in webkit CHROME. so the text in the input field is aligned in an ugly way. Anyone else seen this and now how to fix it?

谢谢

看看你的标签,我假设你写的是...... ...

Looking at your tags, I'm assuming you are writing something like...

<input type="text" placeholder="whatever">

不幸的是,当涉及到占位符的样式时,Chrome会牵制你的手,选择器看起来像这样。 。

Unfortunately, Chrome ties your hands when it comes to styling the placeholder, the selector looks like this...

input::-webkit-input-placeholder {}

您可以在为HTML占位符设置样式