google等webkit浏览器下,设置input输入框自动(选择)填充的字体颜色

场景:让input的字体为白色、背景色为#40a6f5、去除默认的边界、阴影

input:-webkit-autofill,select:-webkit-autofill {  
    -webkit-box-shadow: 0 0 0px 1000px #40a6f5  inset !important;  
} 
#loginForm input#login {
    background-color: transparent;
	margin: 0 auto auto 36px !important;
	padding: 0 !important;
	outline-color: invert !important;
	outline-style: none !important;
	outline-width: 0px !important;
	border: none !important;
	color: white !important;
	border-style: none !important;
	text-shadow: none !important;
	-webkit-appearance: none !important;
	-webkit-user-select: text !important;
	outline-color: transparent !important;
	width: 220px;
	color: white;
	box-shadow: none;
}

#loginForm input::-webkit-input-placeholder {
  color: white !important;    /* WebKit browsers */
}

#loginForm input:-moz-placeholder {
  color: white !important;   /* Mozilla Firefox 4 to 18 */
}

#loginForm input::-moz-placeholder {
  color: white !important;   /* Mozilla Firefox 19+ */
}

#loginForm input:-ms-input-placeholder {
  color: white !important;   /* Internet Explorer 10+ */
}

页面效果如下:




设置了input框的字体颜色为白色,但是手动选择填充(或自动填充)的字体的颜色却是黑色的!!如下图




解决方案:

使用text-fill-color样式属性,添加的内容如下


#loginForm input#login {     
        ...
	text-fill-color: white;
	-webkit-text-fill-color: white; 
}










评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值