當用戶登錄過你的網(wǎng)站,而且你的表單設置了autocomplete, 當用戶再次登錄時,瀏覽器會自動填充表單,這很方便,但是,同時填充的還有:
這個難看的屎黃色??
多好看的界面啊! 被這坨屎黃壞了事.
我們來看看國外開發(fā)者們對這個顏色的特征的憤怒:
https://bugs.chromium.org/p/chromium/issues/detail?id=46543
原因就是chrome的在user agent stylesheet中的這一段樣式
input:-webkit-autofill, textarea:-webkit-autofill, select:-webkit-autofill {
background-color: rgb(250, 255, 189);
background-image: none;
color: rgb(0, 0, 0);
}
不知為何我們不能直接覆蓋這個user agnet style, 它的優(yōu)先級不是沒有author style高嗎? 為什么不能覆蓋? 等待解釋
看到了一個解決辦法:
input:-webkit-autofill {
-webkit-box-shadow:0 0 0 50px white inset; /* Change the color to your own background color */
}
這個方法對大多數(shù)的設計都是可以使用的,但是如果輸入背景不是純色的,而是圖片,這個解決辦法就沒有那么好了.