62

When I click a link on my website it is creating an outline around the link like so

enter image description here

I've tried adding:

a.image-link:focus { outline: 0; }

and

a {outline : none;}

But nothing seems to get rid of it. Is there a way to remove it?

SaturnsEye
  • 6,297
  • 10
  • 46
  • 62
  • 2
    maybe `a:active{outline: 0;}` – Esteban Rincon Jan 06 '16 at 14:33
  • Possible duplicate of [How can I remove the outline around hyperlinks images?](http://stackoverflow.com/questions/814366/how-can-i-remove-the-outline-around-hyperlinks-images) – isherwood Jan 06 '16 at 14:33
  • 4
    Be aware that those outlines are very important for some disabled users. Many of us have consented to their existence for that reason. https://www.tjvantoll.com/2013/01/28/stop-messing-with-the-browsers-default-focus-outline/ – isherwood Jan 06 '16 at 14:34

8 Answers8

89

You can just use this:

a:active, a:focus {
  outline: 0;
  border: none;
  -moz-outline-style: none;
}
MichaelMav
  • 80
  • 1
  • 1
  • 10
Nuno Bentes
  • 1,475
  • 13
  • 26
12

If at-least one of the solutions above doesn't work for anyone. Give this a try as well

a:active, a:focus {
 box-shadow: none;
}
VKS
  • 487
  • 2
  • 7
  • 21
5

Just add a:visited { outline: none; } in your style file.

Rajeev
  • 119
  • 3
  • 4
4

try all of these until u find what works in your case.

a:active, a:focus, li:focus, li:active {
    outline: none !important;
    border: none !important;        
    text-decoration: none !important;
    box-shadow: none !important;
    -webkit-tap-highlight-color: transparent !important;
    -webkit-user-select: none; /* Chrome/Safari */
    -moz-user-select: none; /* Firefox */
    -ms-user-select: none; /* IE10+ */
    user-select: none;
}
Naresh Bisht
  • 645
  • 6
  • 16
3

Simply add outline:none; text-decoration:none;

Pullat Junaid
  • 3,224
  • 3
  • 25
  • 25
1

Fixed:

Found out in my CSS that there was code already being generated to create an outline on a:active. This was overriding my code and removing it fixed the problem.

SaturnsEye
  • 6,297
  • 10
  • 46
  • 62
1

Worked for me

I battled this for a while and this worked for me on WordPress 5.5.3 with StoreFront theme:

a:hover,
a:active {
    outline: none;
    box-shadow: none !important;
}
Mikeey
  • 11
  • 1
0

Worked for me

a:focus-visible {
  outline: none;
}
Fahimeh Ahmadi
  • 813
  • 8
  • 13