Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Remove Button Shadow

I am working in Bootstrap 3 and trying to remove the shadow/outline of my buttons. The code I have currently does this partially. The outline still appears for a split-second when the button is clicked.

Here is a link to my codepen.

 .btn:active,
 .btn:focus,
 .btn.active {
   background-image: none;
   outline: 0;
   -webkit-box-shadow: none;
   box-shadow: none;
 }
like image 220
Hudson Taylor Avatar asked Aug 29 '16 16:08

Hudson Taylor


People also ask

How do I remove a button shadow in bootstrap?

Use the . shadow-none class in Bootstrap to remove shadow.

How do you get rid of the shadow of the high button in flutter?

Just set them all to 0.


2 Answers

UPDATE - Boostrap 4

In this version you can remove the button shadow by using utility class shadow-none.

.btn {
  height: 100px;
  width: 100px;
}
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" />
<div class="container-fluid">
  <div class="row">
    <div class="col-3">
      <button class="btn shadow-none">No Shadow</button>
    </div>
    <div class="col-3">
      <button class="btn shadow-sm">Shadow Small</button>
    </div>
    <div class="col-3">
      <button class="btn shadow">Regular Shadow</button>
    </div>
    <div class="col-3">
      <button class="btn shadow-lg">Shadow Large</button>
    </div>    
  </div>
</div>

See more info here


OLD Answer - Bootstrap 3

You were missing this:

.btn.active.focus, .btn.active:focus, .btn.focus, .btn.focus:active, .btn:active:focus, .btn:focus {
  outline: thin dotted;
  outline-offset: -2px;
}

So you need to reset it. (!important only used for demo - DO NOT USE in your development code)

Snippet

.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;
}
<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>
like image 100
dippas Avatar answered Sep 17 '22 20:09

dippas


bootstrap 4

in my case it was enough:

.btn:focus{
box-shadow: none !important;
}
like image 23
Patryk K Avatar answered Sep 19 '22 20:09

Patryk K