0

Hi guys Im working on basic signup and signin forms.In my input fields I consist of background image and white color.In chrome autofill was replacing my background image and color with pale yellow color.For this I have searched and found out few lines of code....

input:-webkit-autofill {
background-color: #FAFFBD !important;
  }

This was making my backgroundcolor to display...but Unable to show the backgroundimage in input field.Can I get few bits of code to show the background image when autofill in chrome.

 input#email {
background: url("~mail.png") no-repeat scroll  16px 11px #FFFFFF;
background-size: 20px 20px;
z-index: 999;
}
Ramz
  • 658
  • 1
  • 7
  • 19

2 Answers2

0

IMHO, you can do this in 2 ways

1: put a z-index field on your css to your background image so that it overlaps whatever is overlapping it at the moment

z-index: 999 //for example

2: Or make your image have top-margin to make way for the input field's autofill space:

margin-top: 25px;
vishnu
  • 730
  • 2
  • 6
  • 26
0

Try the change with jQuery:

if ($.browser.webkit) {
    //$('input[name="password"]').attr('autocomplete', 'off');
    $('input[name="password"]').attr('background-image', 'src');
}
  • 1
    Suggestion: you case give an absolute div with background image behind the input and give a background none, transparent for the input, to display the background image, but i don't sure if the background image will be viewed with auto fills! – Mouhamad Ounayssi Dec 06 '13 at 11:32