更改自动填充输入字段的字体颜色 [英] Change font color of autofill input field

查看:104
本文介绍了更改自动填充输入字段的字体颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经设法使用以下代码将自动填充的输入字段的背景颜色从黄色更改为白色:

I've managed to change the background color of an autofilled input field from yellow to white with the following code:

input.login:-webkit-autofill {
    -webkit-box-shadow: 0 0 0 1000px white inset;
}

但是,将字体颜色更改为灰色只需添加 color:#999; 无法正常工作。我该如何解决这个问题?非常感谢!

However, changing the font color to grey simply by adding color: #999; doesn't work. How could I fix this? Many thanks!

推荐答案

尝试以下 CSS

input:-webkit-autofill {
    -webkit-box-shadow:0 0 0 50px white inset; /* Change the color to your own background color */
    -webkit-text-fill-color: #999;
}
input:-webkit-autofill:focus {
    -webkit-box-shadow: /*your box-shadow*/,0 0 0 50px white inset;
    -webkit-text-fill-color: #999;
}

这篇关于更改自动填充输入字段的字体颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆