zoukankan      html  css  js  c++  java
  • #-webkit-autofill##google#启用表单自动填充时,如何覆盖黄色背景

    #-webkit-autofill##google#启用表单自动填充时,如何覆盖黄色背景

    google和opera浏览器的表单自动填充后,输入框均会变成黄色背景,黑色字体。如下图。

    autofill

    这样的话会与网页的整体设计风格不一致,怎样自定义样式,来覆盖黄色背景。

    首先来看看是什么导致的,右键查看元素样式:

    input:-webkit-autofill,textarea:-webkit-autofill, select:-webkit-autofill{
      rgb(250, 255, 189);
      background-image: none;
      color: rgb(0, 0, 0);
    }
    一目了然了,-webkit-autofill重新渲染了input的背景色及字体颜色。
     
    ok,原因找到了,解决方法也有了,重写-webkit-autofill
    1, Not working (不起效果)
    input:-webkit-autofill,textarea:-webkit-autofill, select:-webkit-autofill{
      rgb(255, 255, 255);
      background-image: none;
      color: rgb(102, 102, 102);
    }
    2,  Not working(不起效果)
    input:-webkit-autofill,textarea:-webkit-autofill, select:-webkit-autofill{
      rgb(255, 255, 255) !important;
      background-image: none !important;
      color: rgb(102, 102, 102) !important;
    }
    3, working(起效果)
    input:-webkit-autofill,textarea:-webkit-autofill, select:-webkit-autofill{
      -webkit-box-shadow:0 0 0 50px white inset; /* Change the color to your own background color */
      -webkit-text-fill-color: #666;
    }
     
    ok 表单的黄色填充颜色没有了,
    autofill ok
     
  • 相关阅读:
    6174问题
    阶乘的精确值
    小学生算术
    Primer回顾 数组和指针
    Primer回顾 标准库类型
    绪论
    字符串的存储
    条款39:明智而审慎的使用private继承
    条款34:区分接口继承和实现继承
    条款33:避免遮掩继承而来的名称
  • 原文地址:https://www.cnblogs.com/yaomengli/p/9376418.html
Copyright © 2011-2022 走看看