2017-05-04 52 views
0

我正在使用一些登錄/重置密碼/確認密碼錶單,我需要自動填充不要刪除我的背景圖像輸入字段。我使用這段代碼使背景透明,但是有沒有辦法保存當前圖像?Chrome自動填充刪除輸入背景

input:-webkit-autofill, 
input:-webkit-autofill:hover, 
input:-webkit-autofill:focus, 
input:-webkit-autofill:active { 
transition: background-color 5000s ease-in-out 0s; 
-webkit-text-fill-color: #fff !important; 
} 

我的輸入字段:

input { 
width: 425px; 
height: 40px; 
margin-bottom: 30px; 
line-height: 40px; 
border: 0; 
border-bottom: 1px solid #393939; 
outline: none; 
color: #fff; 

&.ng-invalid.ng-dirty.ng-touched, 
&.ng-invalid.ng-touched{ 
border-bottom: 1px solid red; 
} 
&.password{ 
background: url('../../assets/img/password.png') no-repeat; 
} 
&.email{ 
background: url('../../assets/img/mail.png') no-repeat; 
} 
} 

在此先感謝。

回答

0

因爲我不能因缺乏信​​譽的評論,我發佈一個答案:

我認爲應該工作:(你不需要使用background-color更改黃色的背景你可以做到這一點與box-shadow

input:-webkit-autofill { 
    -webkit-box-shadow: 0 0 0px 1000px #fff inset; 
    -moz-box-shadow: 0 0 0 100px #fff inset; 
    box-shadow: 0 0 0 100px #fff inset; 
    /* change the white to any color */ 
} 

要更改文本顏色,使用:

-webkit-text-fill-color: green !important; 

或者,如果你不想自動填充在所有你可以在你的HTML設置此:

<form autocomplete="off">...</form> 
+0

那不是它,它只是設置的背景下,我需要的東西是完全透明的,所以我的背景圖像保持它在哪裏。感謝您的試用 – grabnem

+0

是的,所以最簡單的解決方案就是根本禁用自動完成功能。 –