Подтвердить что ты не робот

Изменение цвета шрифта поля ввода автозаполнения

Мне удалось изменить цвет фона поля автозаполнения с желтого на белый со следующим кодом:

input.login:-webkit-autofill {
    -webkit-box-shadow: 0 0 0 1000px white inset;
}

Однако изменение цвета шрифта до серого просто путем добавления color: #999; не работает. Как я могу это исправить? Большое спасибо!

4b9b3361

Ответ 1

Попробуйте ниже CSS

input:-webkit-autofill {
    -webkit-box-shadow:0 0 0 50px white inset; /* Change the color to your own background color */
    -webkit-text-fill-color: #999;
}
input:-webkit-autofill:focus {
    -webkit-box-shadow: /*your box-shadow*/,0 0 0 50px white inset;
    -webkit-text-fill-color: #999;
}

Ответ 2

Попробуйте использовать CSS:

/* Change Autocomplete styles in Chrome*/
input:-webkit-autofill,
input:-webkit-autofill:hover, 
input:-webkit-autofill:focus
input:-webkit-autofill, 
textarea:-webkit-autofill,
textarea:-webkit-autofill:hover
textarea:-webkit-autofill:focus,
select:-webkit-autofill,
select:-webkit-autofill:hover,
select:-webkit-autofill:focus {
  border: 1px solid green;
  -webkit-text-fill-color: green;
  -webkit-box-shadow: 0 0 0px 1000px #000 inset;
  transition: background-color 5000s ease-in-out 0s;
}

Мы можем использовать псевдоселектор -webkit-autofill, чтобы нацелить эти поля и стилизовать их по своему усмотрению.

Ответ 3

input:-webkit-autofill {
    color: #999 !important;
}

Это сработает для вас!