简体   繁体   English

通过选择制表键不改变按钮的背景色

[英]Background color of the button is not changing through tab key selection

When I hover on the button through mouse pointer the background color is changing, but through the tab key background color is not changing. 当我通过鼠标指针悬停在按钮上时,背景颜色正在更改,但是通过Tab键却未更改背景颜色。

In html 在html中

<style>
    .btn-primary {
        color: #fff;
        background-color: #227ab9;  
        border: none;
        cursor: pointer;
    }
    .BtnStyle {
        text-transform: uppercase;
        font-weight: 700;
        border-radius: 4px;
    }
    .btn-primary:hover,.btn-primary:focus,.btn-primary:active{
        background-color: #1a5e8e;

    }
</style>    

<table>
    <td><input id="txt" class="" type="text" value=""></td>
    <td id="go" class="BtnStyle btn-primary" >
        <button class="btn-primary"><i class="fa fa-chevron-save" aria-hidden="true"></i>test</button>
    </td>
</table>
<style>
    .btn-primary {
        color: #fff;
        background-color: #227ab9;  
        border: none;
        cursor: pointer;
    }
    .BtnStyle {
        text-transform: uppercase;
        font-weight: 700;
        border-radius: 4px;
    }
    .btn-primary:hover,.btn-primary:focus,.btn-primary:active{
        background-color: #1a5e8e;

    }
</style>    

<table>
    <td><input id="txt" class="" type="text" value=""></td>
    <td id="go" class="BtnStyle btn-primary" >
        <button class="btn-primary"><i class="fa fa-chevron-save" aria-hidden="true"></i>test</button>
    </td>
</table>

Your code is working fine for me! 您的代码对我来说很好! Please take a look at below code. 请看下面的代码。

Or if you are still having a problem please share your full code in jsFiddle. 或者,如果您仍然遇到问题,请在jsFiddle中共享您的完整代码。

Take a look at this 看看这个

body {
    padding: 50px;
}
.btn-primary {
  color: #fff;
  background-color: #227ab9;  
}
.BtnStyle {
  text-transform: uppercase;
  font-weight: 700;
  border-radius: 4px;
}
 .btn-primary:hover,.btn-primary:focus,.btn-primary:active{
    background-color: red;// #1a5e8e;

}


<table>
    <td><input id="txt" class="" type="text" value=""></td>
    <td id="go" class="BtnStyle btn-primary" >
                <button class="btn-primary"><i class="fa fa-chevron-save" aria-hidden="true"></i> Button</button>
   </td>
</table>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM