如何更改此类的输入或引导自动填充的颜色(input#email.form-control)

问题描述 投票:0回答:1

基本上,我想在使用浏览器自动填充或保存的电子邮件(同一输入框中以前使用过的电子邮件的下拉列表)时更改输入字段的颜色。为此,我使用了这些 css 属性。

.form-control:-webkit-autofill,
.form-control:-webkit-autofill:hover,
.form-control:-webkit-autofill:focus,
.form-control:-webkit-autofill:active {
  -webkit-box-shadow: none !important;
  -webkit-text-fill-color: black !important;
}
<div class="row">
  <div class="col-md-12">
    <label for="email">Email:</label>
  </div>
  <div class="col-md-12">
    <input type="email" class="form-control" id="email" placeholder="Enter your email">
  </div>
</div>

但是当我从下拉列表中选择任何自动填充/保存的电子邮件时,问题仍然存在,它将输入字段背景更改为蓝色,而我想保持其白色/透明。

html css autofill form-control input-field
1个回答
0
投票

使用此 css 属性后问题已解决

input:-webkit-autofill { 
    -webkit-background-clip: text;
  }

Issue Screenshot

See when the issue was resolved using this css property

© www.soinside.com 2019 - 2024. All rights reserved.