3

I have a div that, when clicked, the button inside of it will create an outline around it, like so:

image outline

**Code: **

.slide-arrow {
  color: #fff;
  background-color: #9E9997;
  border: none;
  padding: 16px 10px 17px 10px;
  font-size: 25px;
  opacity: 0.5;
  outline: 0;
}

.slide-arrow-right {
  position: absolute;
  top: 50%;
  right: 0%;
  transform: translate(0%, -50%);
  -ms-transform: translate(0%, -50%);
  margin-right: -1px;
  border-bottom-left-radius: 4px;
  border-top-left-radius: 4px;
}

.slide-arrow-left {
  position: absolute;
  top: 50%;
  left: 0%;
  transform: translate(0%, -50%);
  -ms-transform: translate(-0%, -50%);
  border-bottom-right-radius: 4px;
  border-top-right-radius: 4px;
}

.slide-arrow:hover {
  opacity: 0.7;
}

.slide-arrow:active {
  background-color: #D47C7C;
}

.slide-arrow i {
  font-size: 32px;
  outline: 0 !important;
}

.slide-arrow i:focus {
  outline: 0 !important;
}
<button class="slide-arrow slide-arrow-right" onclick="plusDivs(1)"><i class="fa fa-angle-double-right"></i></button>

I want this removed. But when applying outline: 0 !important; to just about everything, nothing seems to work. This only seems to happen in firefox.

Adam
  • 1,385
  • 1
  • 10
  • 23
Felix
  • 2,532
  • 5
  • 37
  • 75

2 Answers2

8

that's the focus. Among other things it is important for accessibility (it shows what element is currently selected/has been clicked), so actually you shouldn't remove it.

If you still want to remove it, add this to your stylesheet:

:focus {
  outline: none !important;
}
Johannes
  • 64,305
  • 18
  • 73
  • 130
  • The style change doesn't produce the intended result. However, if it really is important for accessibility, I might just leave it then. – Felix May 19 '18 at 19:55
  • I just saw the last CSS rule in your code. Since that one has added `!important`, you would have to add `!important`as well to the rule I posted. (I just edited my answer accordingly) – Johannes May 19 '18 at 19:56
0

You can use outline: none on that tag while on button :active and :focus.

Abhishek Shah
  • 436
  • 1
  • 3
  • 12