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;
    } 
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章