0

I'm getting a strange outline around certain small images that I have programmatically focused using jquery. How can I fix this?

enter image description here

I need a border on it because I have a :focus class that defines what color I want the outline to be. However, when I remove the border and add 1px solid #2b5367; to outline, or remove the outline and set the border to 1px solid #2b5367; I get this: enter image description here

Which is also not what I want. I want the outter border in the first image to appear, but the inner one to not be there.

Here is the fiddle: http://jsfiddle.net/u1enqp1e/

Joshua Terrill
  • 1,995
  • 5
  • 21
  • 40

2 Answers2

0

As alvarado mentioned, try adding this to your css:

.classHere:focus {
    outline:0;
    border:0;
    box-shadow: none !important;
    -moz-box-shadow: none !important;
    -webkit-box-shadow: none !important;
}

But as you might have noticed, I have added box-shadow too along with outline and border.

You can remove the !important if the css is placed below your other css files.

AndrewL64
  • 15,794
  • 8
  • 47
  • 79
0

Apparently if you first set the outline of focused items to 0, you are then able to override the outline color using something like this.

*:focus {
    outline: none;
}

a:focus img {
    border: 1px solid #2b5367;
    box-shadow: 0px 0px 3px 1px rgba(131, 190, 223, 1);
    border-radius: 3px;
}

Here's a working fiddle: http://jsfiddle.net/wv83g8r5/

Joshua Terrill
  • 1,995
  • 5
  • 21
  • 40