删除按钮阴影

Hud*_*lor 7 html css twitter-bootstrap twitter-bootstrap-3

我正在Bootstrap 3中工作并尝试删除按钮的阴影/轮廓.我目前的代码部分地执行了此操作.单击按钮时,轮廓仍会显示为瞬间.

这是我的codepen的链接.

 .btn:active,
 .btn:focus,
 .btn.active {
   background-image: none;
   outline: 0;
   -webkit-box-shadow: none;
   box-shadow: none;
 }
Run Code Online (Sandbox Code Playgroud)

Phi*_*ker 8

目前(尚未)记录,但是Bootstrap 4.1支持添加一个类shadow-none来删除阴影。

<link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.1.0/css/bootstrap.min.css" rel="stylesheet"/>

<p>Click both buttons below to see the difference:</p>
<button class="btn">Bootstrap button</button>
<button class="btn shadow-none">Bootstrap (4.1) button without shadow</button>
Run Code Online (Sandbox Code Playgroud)


dip*_*pas 6

你错过了这个:

.btn.active.focus, .btn.active:focus, .btn.focus, .btn.focus:active, .btn:active:focus, .btn:focus {
  outline: thin dotted;
  outline-offset: -2px;
}
Run Code Online (Sandbox Code Playgroud)

所以你需要重置它.(!important仅用于演示 - 请勿在开发代码中使用)

片段

.container-fluid {
  text-align: center;
}
body .btn {
  height: 170px;
  width: 170px;
  border-radius: 50% !important;
  outline: 0 !important;
}
.btn.active.focus,
.btn.active:focus,
.btn.focus,
.btn.focus:active,
.btn:active:focus,
.btn:focus {
  outline: 0 !important;
  outline-offset: 0  !important;
  background-image: none  !important;
  -webkit-box-shadow: none !important;
  box-shadow: none  !important;
}
Run Code Online (Sandbox Code Playgroud)
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" />
<div class="container-fluid">
  <p>result</p>
  <div class="row">
    <div class="col-sm-4">
      <button class="btn">Rock</button>
    </div>
    <div class="col-sm-4">
      <button class="btn">Paper</button>
    </div>
    <div class="col-sm-4">
      <button class="btn">Scissors</button>
    </div>
  </div>
</div>
Run Code Online (Sandbox Code Playgroud)


小智 6

引导程序 4

就我而言,这就足够了:

.btn:focus{
box-shadow: none !important;
}
Run Code Online (Sandbox Code Playgroud)