gregoryp
gregoryp

Reputation: 1019

Change autocomplete background color on google chrome in css

Yes, there's a lot of questions about this, but none of them seems to work with me.

I need to change the autocomplete background color on google chrome:

enter image description here

enter image description here

I already tried all of this:

Solution 1

Solution 2

Solution 3

This is my css:

input:-webkit-autofill { -webkit-box-shadow: 0 0 0px 1000px black inset; }

And this is my cshtml:

 <div class="row m-t-50">
       <div class="input-field col s12">
           <input id="last_name" type="text" class="validate" asp-for="Username">
           <label for="last_name">Usuário</label>
       </div>
    </div>

Any ideas?

Upvotes: 0

Views: 1001

Answers (1)

Amir H. Bagheri
Amir H. Bagheri

Reputation: 1416

First of all, the code should be working and appropriate. In my mind, there could be two possible reasons of seeing not any changes in your css class:

1- One scenario that happened to me a number of times is when Chrome does not apply defined css styles to the page properly and the only solution I've found to this problem is to restart the computer.

2- If you are using a css library such as Bootstrap or MDL, ensure that they do not have predefined identical definition. I have never checked it out. However, by using the Chrome Developer Tools, you may figure it out:

enter image description here

enter image description here

Upvotes: 1

Related Questions