Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/33.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/google-chrome/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Css 仅在焦点上输入自动填充背景黄色(谷歌浏览器)_Css_Google Chrome - Fatal编程技术网

Css 仅在焦点上输入自动填充背景黄色(谷歌浏览器)

Css 仅在焦点上输入自动填充背景黄色(谷歌浏览器),css,google-chrome,Css,Google Chrome,我在google chrome上的输入有一个问题,即使我添加了与此问题相关的其他线程上发现的css代码,它仍然存在于鼠标焦点上 当输入没有聚焦时,我很容易将其清除,但只要我单击它,它就会变为黄色。我试过几种组合,但到目前为止都不会消失 以下是我尝试过的一些例子: input:focus:-webkit-autofill { -webkit-box-shadow: 0 1px 1px 1000px #f7f7f7 inset, 0 0 2px rgba(109,157,78,.6);

我在google chrome上的输入有一个问题,即使我添加了与此问题相关的其他线程上发现的css代码,它仍然存在于鼠标焦点上

当输入没有聚焦时,我很容易将其清除,但只要我单击它,它就会变为黄色。我试过几种组合,但到目前为止都不会消失

以下是我尝试过的一些例子:

input:focus:-webkit-autofill {
    -webkit-box-shadow: 0 1px 1px 1000px #f7f7f7 inset, 0 0 2px rgba(109,157,78,.6);
    -webkit-text-fill-color: #333;
}

input:-webkit-autofill:focus {
    -webkit-box-shadow: 0 1px 1px 1000px #f7f7f7 inset, 0 0 2px rgba(109,157,78,.6);
    -webkit-text-fill-color: #333;
}
我还尝试使用输入的id而不是输入

这是我的完整css文件,以备需要

body {
    margin: 0;
    pasdding: 0;
    position: static;
}

body.ftp li#current-ftp, 
body.projects li#current-projects, 
body.contact li#current-contact {
    font-weight: bold;
    text-shadow: 0 0 1px #aaa;
}

#navbar-header {
    position: absolute;
    top: 0;
    right: 0;
    left: 0;
    margin: 0;
    padding: 0;
}

#navbar-header #menu-left {
    float: left;
    display: inline-block;
    margin-left: 20px;
    font-family: 'Comfortaa', cursive;
    font-size: 16px;
    line-height: 1;
    color: #3F3F3F;
}

#navbar-header #menu-right {
    float: right;
    display: inline-block;
    margin-right: 20px;
    font-family: 'Comfortaa', cursive;
    font-size: 16px;
    line-height: 1;
    color: #3F3F3F;
}

#navbar-header ul {
    display: inline-block;
    list-style-type: none;
    margin: 5px 0 0 0;
    padding: 0;
    vertical-align: top;
    font-size: 16px;
    line-height: 1;
}

#navbar-header ul.icon li {
    display: inline-block;
    padding: 2px;
    margin: 0;
    vertical-align: top;
}

#navbar-header ul.txt li {
    font-family: 'Comfortaa', cursive;
    font-size: 16px;
    color: #3F3F3F;
    display: inline-block;
    margin: 0;
    padding: 8px 0 0 0;
}

#navbar-header ul.txt li a {
    font-family: 'Comfortaa', cursive;
    font-size: 16px;
    color: #3F3F3F;
    text-decoration: none;
    margin: 0;
    padding: 8px;
}

#navbar-header ul.txt a:hover {
    text-shadow: 0 0 1px #666;
}

#navbar-header #login-menu, #navbar-header #panel-menu {
    position: absolute;
    top: 0;
    right: 0;
    margin: 0;
    padding: 0;
}

#navbar-header #login-bubble {
    font-family: 'Open Sans', sans-serif;
    z-index: 5;
    visibility: hidden;
    color: #AAAAAA;
    position: absolute;
    right: 10px;
    top: 50px;
    width: 250px;
    height: 130px;
    padding: 0 15px 0 15px;
    background: #FFF;
    -webkit-border-radius: 3px;
    -moz-border-radius: 3px;
    border-radius: 3px;
    border: #CCC solid 1px;
    -moz-box-shadow:0 0 8px 0 #DDD;
    -webkit-box-shadow:0 0 8px 0 #DDD;
    box-shadow:0 0 8px 0 #DDD;
}

#navbar-header #login-bubble:after {
    content: '';
    position: absolute;
    border-style: solid;
    border-width: 0 10px 10px;
    border-color: #FFF transparent;
    display: block;
    width: 0;
    z-index: 1;
    top: -10px;
    left: 214px;
}

#navbar-header #login-bubble:before {
    content: '';
    position: absolute;
    border-style: solid;
    border-width: 0 11px 11px;
    border-color: #DDD transparent;
    display: block;
    width: 0;
    z-index: 0;
    top: -12px;
    left: 213px;
}

#login-username, #login-password {
    margin-bottom: 15px;
}
#navbar-header .username-icon {
    position: absolute;
    display: block;
    color: darken(#EDEDED, 10%);
    left: 23px;
    top: 15px;
    font-size: 20px;
    line-height: normal;
}

#navbar-header .password-icon {
    position: absolute;
    display: block;
    color: darken(#EDEDED, 10%);
    left: 25px;
    top: 62px;
    font-size: 20px;
    line-height: normal;
}

#navbar-header input#txt_username, #navbar-header input#txt_password {
    font-family: inherit;
    box-sizing:border-box;
    border-radius: 3px;
    font-size: 14px;
    height: 30px;
    line-height: 30px;
    width: 100%;
    margin: 15px 0 0 0;
    padding: 0 8px 0 30px ;
    display: block;
    background-color : #f7f7f7; 
    border: 1px solid #CCC;
    transition: 0.3s ease-out;
    -webkit-transition: 0.3s ease-out;
    -moz-transition: 0.3s ease-out;
    color: #333;
}

#navbar-header input#txt_username:focus, #navbar-header input#txt_password:focus {
    padding: 0 8px 0 10px ;
    background-color : #f7f7f7; 
    border-color: #a6ba89;
    outline: 0px;
    -webkit-box-shadow: inset 0 1px 1px rgba(0,0,0,.075), 0 0 2px rgba(109,157,78,.6);
    -moz-box-shadow: inset 0 1px 1px rgba(0,0,0,.075), 0 0 2px rgba(109,157,78,.6);
    box-shadow: inset 0 1px 1px rgba(0,0,0,.075), 0 0 2px rgba(109,157,78,.6)
}

input:-webkit-autofill {
    -webkit-box-shadow: 0 0 0px 1000px #fcfcfc inset;
    -webkit-text-fill-color: #333;
}

.placeholder {color: #aaa }
::-webkit-input-placeholder {color: #aaa}
:-moz-placeholder {color: #aaa}

#navbar-header #forgotten-pwd {
    font-size: 13px;
    font-family: inherit;
    margin-top: 12px;
    display: inline-block;
}

#navbar-header #forgotten-pwd a {
    text-decoration: none;
    color: #999;
}

#navbar-header #forgotten-pwd a:hover {
    color: #f48a00;
}

#button-border {
    width: 61px;
    height: 30px;
    border-bottom-left-radius: 32px;
    border-bottom-right-radius: 32px;
    border: 1px solid #CCC;
    border-top: 0;
    position: absolute;
    right: 26px;
    bottom: -30px;
    -moz-box-shadow:0 0 8px 0 #DDD;
    -webkit-box-shadow:0 0 8px 0 #DDD;
    box-shadow:0 0 8px 0 #DDD;
}

#submit-button {
    font-family: inherit;
    z-index: 1000;
    position: absolute;
    top: 105px;
    right: 34px;
}
#sub-login {
    font-family: inherit;
    width: 45px;
    height: 45px;
    display: block;
    margin: 0 auto -15px auto;
    background: #f7f7f7;
    border-radius: 100%;
    border: 1px solid #a6ba89;
    color: #a6ba89;
    font-size: 26px;
    line-height: 26px;
    cursor: pointer;
    box-shadow: 0px 0px 0px 7px #FFF;
    transition: 0.3s ease-out;
}
#sub-login:hover, #sub-login:focus {
    background: #a6ba89;
    color: #f7f7f7;
    outline: 0;
}

#navbar-header #panel-bubble {
    z-index: 5;
    visibility: hidden;
    color: #AAAAAA;
    position: absolute;
    right: 0;
    top: 0;
    margin-top : 50px;
    margin-right: 10px;
    width: 220px;
    height: 250px;
    padding: 0px;
    background: #FFF;
    -webkit-border-radius: 3px;
    -moz-border-radius: 3px;
    border-radius: 3px;
    border: #CCC solid 1px;
    -moz-box-shadow:0 0 8px 0 #CCC;
    -webkit-box-shadow:0 0 8px 0 #DDD;
    box-shadow:0 0 8px 0 #DDD;
}

#navbar-header #panel-bubble:after {
    content: '';
    position: absolute;
    border-style: solid;
    border-width: 0 10px 10px;
    border-color: #FFF transparent;
    display: block;
    width: 0;
    z-index: 1;
    top: -10px;
    left: 145px;
}

#navbar-header #panel-bubble:before {
    content: '';
    position: absolute;
    border-style: solid;
    border-width: 0 11px 11px;
    border-color: #DDD transparent;
    display: block;
    width: 0;
    z-index: 0;
    top: -12px;
    left: 144px;
}

#panel-more {
    border-top: 1px solid #EEE;
    position: absolute;
    bottom: 0px;
    right: 0px;
    left: 0px;
    height: 30px;
    witdth: 100%;
    background-color: #F7F7F7;
    font: 16px Candara;
    text-align: center;
    vertical-align: middle;
    color: #909090;
    padding-top: 3px;
}

#header-logo {
    position: relative;
    width: 333px;
    margin: 30px auto 15px auto;
}
我输入的id是txt_密码和txt_用户名

以下是表格:

<div id="login-menu">
        <div id="login-bubble">
            <form method="post" action="/ftp/index.php?login=1">
                <span id="login-username">
                    <input type="text" name="username" id="txt_username" placeholder="username" required="" value="" />
                    <span class="username-icon"><i class="fa fa-user"></i></span>
                </span>
                <span id="login-password">
                    <input type="password" name="password" id="txt_password" placeholder="password" required="" />
                    <span class="password-icon"><i class="fa fa-lock"></i></span>
                </span>
                <span id="forgotten-pwd">
                    <a href=""><span>Forgotten Password ?</span></a>
                </span>
                <span id="submit-button">
                    <input type="hidden" name="redirect" value="<?php echo "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]"; ?>" />
                    <button type="submit" name="submit" id="sub-login"><i id="submit"class="fa fa-long-arrow-right"></i></button>
                </span>
                <span id="button-border"></span>
            </form>
        </div>
    </div>
有人知道冲突可能来自哪里吗

非常感谢你的帮助


-Apatik

您可能已经解决了这个问题,但是任何遇到相同问题的人都可以在这里找到解决方案:


非常接近您最初发布的代码,但不完全相同!:

一,。您能在JSFIDLE或类似的东西上显示您的问题吗?2.您必须使用自动完成功能吗?3.您是否尝试了此选择器输入:-webkit autofill?感谢您的回答,我尝试添加了一个JSFIDLE框,但我无法重现此问题,因为它只出现在chrome上,并且需要存储用户名/密码。是的,如果找不到解决此问题的解决方案,我可能会禁用autocomplete,是的,我尝试了输入:-webkit autofill,它确实有效,但输入:-webkit autofill:焦点不起作用: