gpt4 book ai didi

css - Firefox 输入占位符填充问题

转载 作者:太空狗 更新时间:2023-10-29 14:44:20 25 4
gpt4 key购买 nike

为什么 Firefox 不对占位符文本进行填充。 请看这里的例子http://jsfiddle.net/JfrfZ/

如何解决?

HTML

<form method="get" action="/search" id="search">
<input name="q" type="text" size="40" placeholder="Search..." />
</form>

CSS

#search input[type="text"] {
background: url(../img/search-icon.png) no-repeat 2.6% 50% #fcfcfc;
background-size: 6%;
border: 1px solid #d1d1d1;
font: normal 1.7em Arial,Helvetica,Sans-serif;
color: #bebebe;
width: 33%;
padding: 0.6% 2%;
border-radius: 3em;
text-shadow: 0 2px 3px rgba(0, 0, 0, 0.1);
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15) inset;
padding-left: 3.8%;
outline: 0; }

最佳答案

您需要使用 the ::-moz-placeholder psuedo-element (以前是 :moz-placeholder )。

 #search input::-moz-placeholder {
padding: <top> <right> <bottom> <left>;
}

曾经有a bug in Firefox that prevented padding from working on text inputs .因此,如果您需要使用百分比,text-indent 是您的不二之选。

#search input:-moz-placeholder {
text-indent: 3.8%;
}

但该错误已于 2012-08-28 修复并包含在 Firefox 17 中。不再需要使用 text-indent

关于css - Firefox 输入占位符填充问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8794821/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com