Webkit中的HTML5,占位符,行高 [英] HTML5, Placeholder, line-height in Webkit

查看:105
本文介绍了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占位符设置样式

这篇关于Webkit中的HTML5,占位符,行高的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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