【发布时间】:2023-02-15 14:01:00
【问题描述】:
我很难设置输入字体大小当输入在 chrome 和 edge 中自动填充时。我能够获得所需的颜色和边框,但不能获得字体大小。行高似乎也更改为所需字体大小的值。单击页面内容时应用正确的字体大小。令人惊讶的是,在 Firefox 中一切正常。
Chrome 版本:97.0.4692.71
边缘版本:96.0.1054.62
火狐版本:95.0.2
我目前正在使用 CSS 规则来实现这一点:
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
textarea:-webkit-autofill,
textarea:-webkit-autofill:hover,
textarea:-webkit-autofill:focus,
select:-webkit-autofill,
select:-webkit-autofill:hover,
select:-webkit-autofill:focus {
border: 1px solid green;
-webkit-text-fill-color: green;
font-size: 24px !important;
}
谢谢!
【问题讨论】:
-
不幸的是没有。上述解决方案适用于更改颜色的情况,但不适用于字体大小。
-
好吧,我唯一可以补充的是,Chrome 和 Edge 肯定具有相同的行为,因为它们使用相同的渲染引擎(Blink,Opera 也使用),而 Firefox 使用不同的渲染引擎(Gecko)。我希望至少它能让您了解为什么它有时会发生而有时不会。
标签: css google-chrome autofill