我的按钮都有一个高亮后,我点击他们。这是Chrome。

<button class="btn btn-primary btn-block">
    <span class="icon-plus"></span> Add Page
</button>

我正在使用带有主题的Bootstrap,但我非常确定这不是它:我以前在另一个项目中注意到这一点。

如果我使用<a>标签而不是<button>,它就会消失。为什么?如果我想使用<button>,我怎么让它消失呢?


当前回答

这是工作,希望能帮到你

.btn:focus, .btn:focus:active {
    outline: none;
}

其他回答

对于解决方案中使用的AngularJS开发人员:

var element = $window.document.getElementById("export-button");
    if (element){
        element.blur();
    }

记住注入$window。

  .btn:focus,.btn:active, a{
        outline: none !important;
        box-shadow: none;
     }

这个大纲:没有将工作的按钮和标签

这对我很管用。 我创建了一个自定义类,覆盖必要的CSS。

.custom-button:focus {
    outline: none !important;
    border: none !important;
    -webkit-box-shadow: none !important;
    box-shadow: none !important;
}

-webkit-box-shadow适用于Chrome和safari浏览器。

将此添加到脚本中

$(document).ready(function() {
    $('#addBtn').focus(function() {
        this.blur();
    });
});

这是工作,希望能帮到你

.btn:focus, .btn:focus:active {
    outline: none;
}