问题描述:input表单添加了背景图片,结果自动填充是,编程了一个淡黄色矩形方框。

chrome浏览器默认样式覆盖input背景

解决方案:网上查询了很多的解决方式,基本都不管用,这里我简单说两个。

1.去除黄色背景

  input:-webkit-autofill {    -webkit-box-shadow: 0 0 0px 1000px white inset !important; }  

  outline:none;  //去除焦点边框

2.修改readonly属性:

  <input type="password" readonly onfocus="this.removeAttribute('readonly');"/>  

3.借鉴网易163的,可以在不需要默认填写的input框中设置 autocomplete="new-password"

感觉这种学习思路对前端学习很有启发性,遇到问题在网上查询了很多还是解决不了时,可以去网上看看类似的功能别人是如何实现的,而不是一味地的采纳网上天花乱坠的说法。

 

 

 

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-04
  • 2021-12-28
  • 2022-12-23
猜你喜欢
  • 2022-02-07
  • 2022-12-23
  • 2022-12-23
  • 2021-10-24
  • 2021-08-27
相关资源
相似解决方案