开发者

Google Chrome autofill yellow background [duplicate]

开发者 https://www.devze.com 2023-02-05 06:15 出处:网络
This question already has answers here: Closed 11 years ago. Possible Duplicate: How do I stop Chrome from yellowing my site's input boxes?
This question already has answers here: Closed 11 years ago.

Possible Duplicate:

How do I stop Chrome from yellowing my site's input boxes?

I know there are exact开发者_运维百科 duplicates, but none of the answers on them solved my issue (for example How do I stop Chrome from yellowing my site's input boxes?).

When chrome autofills a field it becomes yellow, for some reason. Example picture here: http://nclabs.org/screenshots/1295269850.png

What I want:

  • A CSS or Javascript (even jQuery) solution that prevents the background (not :focus outline!) to become yellow on autofill.
  • That solution must leave the autofill feature intact.

Does anyone know a solution? Thanks!


[2018 UPDATE]

As per the comment by Matt K, it appears that it is now possible. You can refer to this answer for a solution: https://stackoverflow.com/a/25881221/798634

Quote:

// Just change "red" to any color
input:-webkit-autofill {
    -webkit-box-shadow: 0 0 0px 1000px red inset;
}

[ORIGINAL 2011 ANSWER]

Unfortunately, either you disable autocomplete (possibly via JavaScript - see Kyle's answer) or you're doomed to use the gross yellow background. Chrome's internal CSS takes all styling possibilities away from you. This issue dates back to 2008 and still hasn't been solved.


You can use this jQuery to disable the feature:

if ($.browser.webkit) {
    $('input[name="password"]').attr('autocomplete', 'off');
}

But there is no way to change the color of the autofill.

0

精彩评论

暂无评论...
验证码 换一张
取 消