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

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

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

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


当前回答

真不敢相信居然没人贴出来。

使用标签而不是按钮。

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

小提琴

其他回答

直接在HTML标签中(在您可能想要在设计的其他地方留下引导主题的场景中)..

尝试的例子..

<button style="border: transparent;">
<button style="border: 1px solid black;">

. .等。这取决于你想要的效果。

对于任何使用react-bootstrap并遇到此问题的人,以下是我所做的工作:

.btn:focus {
    /* the !important is really the key here, it overrides everything else */
    outline: none !important;
    box-shadow: none !important;
}

在添加!之前,事情并没有工作。

这是工作,希望能帮到你

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

风格

.not-focusable:focus {
    outline: none;
    box-shadow: none;
}

使用

<button class="btn btn-primary not-focusable">My Button</button>

尝试这个解决方案删除按钮周围的边界。将此代码添加到css中。

Try

button:focus{
outline:0px;
}

如果不工作,然后使用下面。

button:focus{
 outline:none !important;
 }