【问题标题】:How to change input name background? [duplicate]如何更改输入名称背景? [复制]
【发布时间】:2020-01-25 10:50:08
【问题描述】:

当我在输入上单击鼠标时,下拉邮件列表,当我将鼠标带到 Miles 时正在更改输入背景。如图所示。 如何移除或更改本次输入背景?

我已经尝试过“专注”,但是没用。

<input type="email" name="email" placeholder="Email">

    input {
        background: none;

        &:focus {
            background: none;
        }
    }

【问题讨论】:

标签: javascript html css sass scss-lint


【解决方案1】:

对于谷歌浏览器,您可以执行以下操作:

input:-webkit-autofill,
input:-webkit-autofill:hover, 
input:-webkit-autofill:focus, 
input:-webkit-autofill:active  {
    -webkit-box-shadow: 0 0 0 30px white inset !important;
}
&lt;input type="text" name="name"&gt;

white 替换为所需的颜色。我从SO answer 中获取了这个 sn-p。深入研究 SO 问题也应该是一个好主意,有一些稍微不同的解决方案可能对您更有效。

请记住,这是非标准的,应该避免使用它,但现在,这是你可以做的。 参考:MDN

【讨论】:

  • 但是如果我不需要那个背景呢?
  • 我不认为你可以,只选择一种可以给人留下印象的颜色。
【解决方案2】:
input:hover {
   background-color: #fff;
}

【讨论】:

  • 如果你想去除盒子阴影然后添加box-shadow: none;
猜你喜欢
  • 2021-06-13
  • 2019-06-02
  • 2020-07-24
  • 1970-01-01
  • 2022-01-22
  • 2021-05-05
  • 2021-03-07
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多