• 一段神奇的代码,解决form表单背景偏黄问题


    一段神奇的代码,解决form表框背景偏黄问题

    最近在做项目时,发现自己做的挺好看的表单,背景变成了黄色,所以这次折腾了好久终于找到了符合我的决绝办法,现在来分享给大家

    一般解决这种input表框偏黄问题有两种情况。

    第一种:没有背景图标的表单

    这种表单解决相对简单,只有几串CSS代码就搞定

    input:-webkit-autofill, textarea:-webkit-autofill, select:-webkit-autofill
        {
    -webkit-box-shadow: 0 0 0px 1000px white inset !important; background-color: rgb(0, 0, 0) !important; background-image: none !important; color: rgb(0, 0, 0) !important; -webkit-tap-highlight-color:rgba(0,0,0,0) !important; }

    第二种:有背景图片input表单

    这种方式需要用到JS,这里贴上代码

    总结:其实第二种代码可以解决所有,所以你们可以选择性的使用!

        if (navigator.userAgent.toLowerCase().indexOf("chrome") >= 0) {
            $(window).load(function(){
                $('input:-webkit-autofill').each(function(){
                var text = $(this).val();
                var name = $(this).attr('name');
                $(this).after(this.outerHTML).remove();
                $('input[name=' + name + ']').val(text);
                });
            });
        }
  • 相关阅读:
    java——spring中bean的作用域
    java——线程池
    java—如何解决缓存穿透
    java—锁的学习研究
    java--springmvc
    java—多线程—notify/notifyAll
    php 基础复习 2018-06-18
    php 基础复习 2018-06-19
    php 以单下划线或双下划线开头的命名
    mysql 常用sql语句
  • 原文地址:https://www.cnblogs.com/yz-blog/p/6649704.html
Copyright © 2020-2023  润新知