如何设置占位符文本的填充 [英] How to set the padding of placeholder text
本文介绍了如何设置占位符文本的填充的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用输入标签,并在其中设置了占位符值。现在,我想在其中设置占位符文本的填充,但是我不能。
I'm using an input tag and have set a placeholder value in it. Now, I want to set the padding for the placeholder text inside it, but I can't.
这是我尝试过的操作:
HTML
<form><input class="tbsearchbar" type="search" name="search_tb" placeholder="Test"></form>
CSS
placeholder {
padding-top: 10px;
}
推荐答案
只需在输入中添加填充像这样:
Just add padding to the input like this:
.tbsearchbar {
padding-top: 10px;
color: red; //To add some color.
}
仅更改占位符颜色:
::-webkit-input-placeholder { /* WebKit browsers */
color: #909;
}
:-moz-placeholder { /* Mozilla Firefox 4 to 18 */
color: #909;
opacity: 1;
}
::-moz-placeholder { /* Mozilla Firefox 19+ */
color: #909;
opacity: 1;
}
:-ms-input-placeholder { /* Internet Explorer 10+ */
color: #909;
}
这篇关于如何设置占位符文本的填充的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文