J. Doe
J. Doe

Reputation: 1

Change background color for input when data is entered

I notice, at least in Chrome, when Autofill puts data into a textbox, the background-color changes to a shade of yellow, is there a way in CSS to override this? I've tried input:active, input:focus and even input:hover but none have worked

Upvotes: 0

Views: 1237

Answers (1)

user6407432
user6407432

Reputation:

You can use this:

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

input:-webkit-autofill:focus {
    -webkit-box-shadow: /*your box-shadow*/,0 0 0 50px white inset;
    -webkit-text-fill-color: #333;
} 

Upvotes: 1

Related Questions