chrome浏览器中自带input样式input:-internal-autofill-selected(修改input背景色)

实现思路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;
    } 
发布了31 篇原创文章 · 获赞 39 · 访问量 9761

猜你喜欢

转载自blog.csdn.net/lys20000913/article/details/104529698