css - CSS 自动完成字体大小
问题描述
将鼠标悬停在来自浏览器的自动完成建议上时,我无法弄清楚如何增加或如何使用预览文本的默认字体大小。
我对所有样式都使用https://tailwindcss.com/。
例如:
这是我输入一些文本后具有默认字体大小的正常输入元素:
这是当我将鼠标悬停在建议的自动完成项目之一时预览的字体大小:
如您所见,字体大小比第一张图片小得多。
我已经在使用一些 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: inherit;
-webkit-text-fill-color: inherit;
-webkit-box-shadow: inherit;
transition: background-color 5000s ease-in-out 0s;
font-size: inherit;
}
最后一个属性font-size
什么都不做。
我使用以下 css 作为输入字体大小:
font-size: 1.125rem !important;
我还尝试将字体大小分配为内联样式来修复它,但效果不佳:
现场示例:https ://codesandbox.io/s/o766kp4z05 使用示例并尝试在电子邮件字段中输入您的电子邮件并查看字体大小。字体大小也有同样的问题。
是否可以修复字体大小?
解决方案
编辑:这不再适用于字体大小,并且可能有更多属性向前发展
如何在输入时更改 Chrome 自动完成样式:
input {
...
font-family: $body-font;
font-size: 1rem;
font-weight: bold;
color: #000;
background-color: #fff;
// Background color
&:-webkit-autofill {
-webkit-box-shadow: 0 0 0 1000px #fff inset;
}
// Font styles
&:-webkit-autofill::first-line {
font-family: $body-font;
font-size: 1rem;
font-weight: bold;
// color: green;
}
}
推荐阅读
- reactjs - 如何在带有 React 应用程序的 Firebase 托管中使用站点地图
- postgresql - 为什么 autovacuum 不清理我的桌子?
- login - linkedin oauth2 登录返回“504 网关超时”
- google-chrome-extension - Chrome 扩展 i18n:拆分 messages.json 文件?
- c# - WriteableBitmap 不要让我画一个矩形 (AccessViolationException)
- r - 名称中带有空格的其他目录中带有 zip 文件的数据表 fread
- .net - 如何实时更新具有正在运行的进程的 ListBox?
- symfony - Symfony 4 - 选项“invalid_message”不存在
- docker - 如何加速`docker load`然后`docker pull`增量更改
- powershell - 如何在获取构建列表 VSTS REST API 中应用过滤器?