實現思路1:如果不是想設置爲透明色 可直接使用box-shadow
input:-webkit-autofill{
-webkit-box-shadow:0 0 0 1000px white inset !important;
}
實現思路2:關閉自動填充功能 ( 也可實現 不推薦 )
<input type="text" autocomplete="off">
實現思路3:通過CSS3動畫解決
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
input:-webkit-autofill:active {
-webkit-transition-delay: 111111s;
-webkit-transition: color 11111s ease-out, background-color 111111s ease-out;
}
代碼示例
.entername>.el-input__inner{
border: none;
line-height: 38px;
padding-left: 10px;
padding-right: 0;
background: transparent;
color:#ccc
}
.enterpassword>.el-input__inner{
border: none;
line-height: 38px;
padding-left: 10px;
padding-right: 0;
background: transparent;
color:#ccc
}
.entername>.el-input__inner:-webkit-autofill,
.entername>.el-input__inner:-webkit-autofill:hover,
.entername>.el-input__inner:-webkit-autofill:focus,
.entername>.el-input__inner:-webkit-autofill:active {
-webkit-transition-delay: 99999s;
-webkit-transition: color 99999s ease-out, background-color 99999s ease-out;
}
.enterpassword>.el-input__inner:-webkit-autofill,
.enterpassword>.el-input__inner:-webkit-autofill:hover,
.enterpassword>.el-input__inner:-webkit-autofill:focus,
.enterpassword>.el-input__inner:-webkit-autofill:active {
-webkit-transition-delay: 99999s;
-webkit-transition: color 99999s ease-out,background-color 99999s ease-out;
}