Remove the default yellow background from the Google Chrome input box

Source: Internet
Author: User

The Google Chrome login page remembers the password and the next login is automatically populated with a yellow background.

Google Chrome is set up as follows:

Input:-webkit-autofill, Textarea:-webkit-autofill, select:-webkit-autofill {
    1. background-color: < Span class= "value" > rgb (+, 255, 189);
    2. background-image: < Span class= "value" >none;
    3. c Olor:  rgb (0, 0, 0);
Remove the yellow background the first way is to override the style and use!important to elevate the priority, except that the chrome default definition of Background-color,background-image,color is not available! Important to elevate its priority, other properties can use!important to elevate its priority.
    1. Input:-webkit-autofill {
    2. -webkit-box-shadow: 0 0 0px 1000px white inset; Use a large enough solid color inner shadow to cover the yellow background
    3. Border: 1px solid #CCC!important;
    4. }

Try the above method, if there is a picture in input, the previous icon will be masked together.

The second method uses jquery to determine if it is a Google browser and then traverse that element, by taking a value, attaching, removing the implementation:

$ (function () {
if (Navigator.userAgent.toLowerCase (). IndexOf ("Chrome") >= 0) {
$ (window). Load (function () {
$ (' Input:not (Input[type=submit]) '). each (function () {
var outhtml = this.outerhtml;
$ (this). Append (outhtml);
});
});
}
});

Remove the default yellow background from the Google Chrome input box

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.