Reputation: 1
I have this login form in Nextjs using tailwind. When selecting an email(saved in google chrome) the input field turns white. How can I solve this? enter image description here
I tried adding a focus but this didn't solve it.
Upvotes: 0
Views: 43
Reputation: 114
You can use :autofill
CSS pseudo-class when an element has its value autofilled by the browser. However you cannot change the background-color, background-image, or color because many browsers use !important in their :-webkit-autofill style declarations.
That is why I searched a little bit a found another solution using background clip.
input:autofill,
input:autofill:hover,
input:autofill:focus,
input:autofill:active {
background-clip: text;
}
In this way instead of trying to change the background color, we painted background within (clipped to) the foreground text. As I checked MDN documents they are compatible with all browsers.
Check this references for more information:
Upvotes: 0