views:

4643

answers:

7

Active hyperlink texts are highlighted with dotted border. When using effects on such hyperlinks (fadeIn/fadeOut) it produces strange effects. How do I disable/remove the dotted border?

+1  A: 

Try this CSS:

a:active { 
    border:none;
    outline:none;
}

Note that this has to be after any a:hover rules.

Lucas Jones
For me, this works in IE8, but FF3.5 ignores it. It still shows dotted border when link is active. Any ideas?
Vnuk
Ignore, I found that FF ignores this css :(
Vnuk
I'm really not sure; perhaps the other answers on this question would be of more help to you.
Lucas Jones
I had to set these for a:visited, too.
PEra
@PEra: Thanks, good to know. :)
Lucas Jones
+2  A: 

Be careful. The dotted-border is a valuable part of keyboard-browsing. It highlights which link will be clicked.

a:active { outline: none; }

Author Nathan Smith gives a more thorough discussion of this, and various related issues on his blog.

Jonathan Sampson
Might want to say keyboard browsing rather than tabbed browsing.
Alistair Knock
+3  A: 

Typical and safe way to do it is this (in non-IE and IE6-7):

a:active, a:focus {
   outline:  none;
   ie-dummy: expression(this.hideFocus=true);
}

Since expresssion() has been gutted in IE8, you may need a script:

if (document.documentElement.attachEvent)
    document.documentElement.attachEvent('onmousedown',function(){
         event.srcElement.hideFocus=true
    });

If you're going to remove default focus outline, you must define your own distinct style for :focus, otherwise keyboard users will have hard time using your site.

porneL
+1  A: 

The a { outline: none; } breaks keyboard usability. And the a:active {} selector seems to break it just as good last time I checked in Firefox.

There is a JS way to get rid of the border without breaking anything as well as JS code to get rid of the border in IE6 and IE7..

I described the method in my tut: http://haslayout.net/css-tuts/view?tut=Removing-Dotted-Border-on-Clicked-Links

Cheers!

Zoffix Znet
Nice tutorial. Good explanations, clear examples.
El Yobo
A: 

People. Sometimes there is a certain place where the dotted line completely ruins the style of the page. You have to be able to remove it in those instances. I have other links that will work for the keyboard users but in the logo I do NOT want the dotted line ruining the style.

Lis
@Lis These types of posts are best as comments on other answers, or the primary question itself.
Jonathan Sampson
A: 

Hola a todos, contestando la pregunta de Vnuk, prueba agregar estos css entre tus estilos para corregir los bordes punteados de los links y botones en Mozila... ¡¡Suerte!!

*|*:-moz-any-link:focus {
  outline: none;
}

*|*:focus
{
  outline: none;
}

button, input[type="reset"], input[type="button"], input[type="submit"] {
  outline: none;
}

button::-moz-focus-inner,
input[type="reset"]::-moz-focus-inner,
input[type="button"]::-moz-focus-inner,
input[type="submit"]::-moz-focus-inner,
input[type="file"] > input[type="button"]::-moz-focus-inner {
  padding: 0px 2px 0px 2px;
  border: 1px dotted transparent;
}
Ana
@Ana Please contribute in English. You can use a translation service like http://translate.google.com for assistance. **Español** *@Ana Por favor, colabore en Inglés. Usted puede utilizar un servicio de traducción como http://translate.google.com para obtener ayuda.*
Jonathan Sampson
A: 

Hi, try with these css:

FOR MOZILA:

|:-moz-any-link:focus { outline: none; }

|:focus { outline: none; }

button, input[type="reset"], input[type="button"], input[type="submit"] { outline: none; }

button::-moz-focus-inner, input[type="reset"]::-moz-focus-inner, input[type="button"]::-moz-focus-inner, input[type="submit"]::-moz-focus-inner, input[type="file"] > input[type="button"]::-moz-focus-inner { padding: 0px 2px 0px 2px; border: 1px dotted transparent; }


For IE8

a:active, a:focus { border:none; outline:none; }

Ana