遇到一个很奇怪的问题,我要修改一个 input 的颜色,代码如下:
input[type="text"],input[type="email"],input[type="url"],input[type="password"],textarea {
	padding:5px;
	width:100%;
	border-radius:2px;
	background-color:#f2f3f5;
	border: 1px solid #f2f3f5;
	-webkit-box-sizing:border-box;
	-moz-box-sizing:border-box;
	box-sizing:border-box;
}
以上代码运行后,border属性是生效的,但是 background-color 不管怎么修改就是不生效,用浏览器自带的检查工具进行检查,发现 background-color:#f2f3f5; 这一条确实是被叉掉了,取而代之的是浏览器默认的样式如下:
input:-internal-autofill-selected {
    appearance: menulist-button;
    background-image: none !important;
    background-color: light-dark(rgb(232, 240, 254), rgba(70, 90, 126, 0.4)) !important;
    color: fieldtext !important;
}
神奇了,为什么不用我写的CSS,而是一定要用浏览器自带的呢??
于是我加了!important; 变成:background-color:#f2f3f5 !important; 以此来提升优先级,但是没有效果,我们发现浏览器自带的样式表也加了!important,这怎么解决??搞了一两个小时了!!