返回博客列表

谷歌浏览器自动填充导致输入框样式问题

2026-01-29
1 min read
css

谷歌浏览器自动填充导致输入框样式问题

谷歌浏览器自动填充导致输入框样式问题

input:-webkit-autofill {
    background-color: var(--color-fill-2) !important; /* 覆盖背景色,white 换成你页面背景色 */
    -webkit-text-fill-color: #000 !important; /* 设置字体颜色 */
    transition: background-color 5000s ease-in-out 0s; /* 避免闪烁 */
}


input:-webkit-autofill:hover {
    background-color: var(--color-fill-3) !important; /* 覆盖背景色,white 换成你页面背景色 */
    -webkit-text-fill-color: #000 !important; /* 设置字体颜色 */
    transition: background-color 5000s ease-in-out 0s; /* 避免闪烁 */
}

input:-webkit-autofill:focus {
    background-color: transparent !important; /* 覆盖背景色,white 换成你页面背景色 */
    -webkit-text-fill-color: #000 !important; /* 设置字体颜色 */
    transition: background-color 5000s ease-in-out 0s; /* 避免闪烁 */
}

返回博客列表
最后更新于 2026-01-29
想法或问题?在 GitHub Issue 下方参与讨论
去评论