html - Angular 6:Chrome 自动填充标签重叠问题
问题描述
自动填充不会触发 chrome 中的更改事件,并且用户名/密码表单标签与自动填充值重叠。附上图片样本。
当前行为:您必须在表单/应用程序内单击才能激活自动填充值。
我已经寻找了各种解决方案,并在 github / chromium bugs 站点上查看了多个线程,但找不到解决此问题的方法。这似乎是 chrome 中的一个错误,由于某些安全问题尚未修复。请提出一种在 Angular 中解决此问题的方法。
解决方案
在以下 github 链接中找到了一些可能的重叠问题解决方案: https ://github.com/Baedda/floating-form-labels/issues/12
我使用纯 css 解决方案解决了我的问题:
html:-
<div>
<input type="text" id="name" name="name">
<label for="name" class="placeholder-label">Name</label>
</div>
CSS :-
input:-webkit-autofill + .placeholder-label {
// your styles for floating label
-webkit-transform: translate3d(5px,-52%,0);
transform: translate3d(5px,-52%,0);
}
推荐阅读
- r - 根据条件跳过 lapply 中的特定值
- listview - Flutter - ListView.builder:初始滚动位置
- javascript - 我试图在谁赢谁输的答案弹出之前延迟(石头剪刀布游戏)
- ruby-on-rails - Rails 嵌套路由未按预期工作
- r - 闪亮的应用程序在所有浏览器上关闭,但资源管理器
- kubernetes - Calico:Kubernetes pod 使用集群 IP 无法互相 ping
- c++ - How to move cursor to end of text output after cin.clear() and cin.ignore()?
- node.js - 猫鼬 findByIdAndUpdate
- bash - awk 变量在 bash 中打印为选项
- json - 将 JSON-Patch 转换为 MarkLogic JSON 补丁规范?