20

I want to do is remove the button blue box shadow effect in my class btnd if the button is click.

current output:

i tried this but it doesnt work.

.btnd:active,
.btnd.active {
  background-image: none;
  outline: 0;
  -webkit-box-shadow: none;
          box-shadow: none;
}
Dusan
  • 791
  • 5
  • 16
user3729634
  • 285
  • 1
  • 4
  • 11
  • Just add `outline: 0;` for `.btnd:focus` as explained here. http://stackoverflow.com/questions/20340138/remove-blue-border-from-css-custom-styled-button-in-chrome#answer-21758143 – Jehanzeb.Malik Jun 14 '14 at 18:17

3 Answers3

40

Blue shadow is browser default :focus state

.btnd:active,
.btnd:focus,
.btnd:focus:active {
  background-image: none;
  outline: 0;
  box-shadow: none;
}
Matej Janovčík
  • 1,242
  • 12
  • 13
  • 2
    Although this answer is technically correct, I am surprised that no one has mentioned that removing the outline is not recommended for accessibility reasons. See http://www.outlinenone.com/ or https://a11yproject.com/posts/never-remove-css-outlines/. – marcvangend Mar 05 '18 at 08:46
29

I deal with this problem just yesterday. You need:

.btnd:focus, .btnd:active, .btnd.active, .btnd:focus:active {
  background-image: none;
  outline: none;
  -webkit-box-shadow: none;
  box-shadow: none;
}

The key is in last selector .btnd:focus:active.

ndcweb
  • 725
  • 4
  • 10
0

just use this line to remove the focus $( "#OK" ).button().blur();

Juergen Schulze
  • 1,515
  • 21
  • 29