We’ve all seen how Firefox will add a dotted border on any links are clicked. When coupled with the Phark technique, Firefox extends that dotted border to include your extremely indented text. However there are three different solutions to this:
The first solution will essentially turn of the border completely leaving no outline
a {
outline: none;
}
before:

After:

The second solution will keep the border nice and tidy with your image.
a {
overflow: hidden;
}
Before:

After:

Lastly if you’re annoyed by the border as much as I am, there are two ways to perform either one of these solutions using the Firefox user style sheet.
But we’ll save that for the next entry.
stumbled upon again! how come I never stumbleupon my blog?!
wow, I’m so freaking excited… this is exactly what I was looking for a week ago.. i was stumbling, stumbling, stumbling and got distracted…I just landed on your page tonight… so thank you!
Swany
http://www.swany.cc
http://www.swany.cc/TravelMap
Indeed, the border is ugly. But with no border, people who go to links on pages using the tab key, now see nothing.
Anna,
Thats why you use method 2, or put an a:active or a:focus state on the image. That way a keyboard user will see a change on the links when using IE or Firefox.
Thanks for your comments.
Be careful with removing the outline. For accessibility reasons these outlines are used, for example if you use tab when you browse by keyboard.
A solution to make clear what link is active, you can apply a style to it by using the
:focusstate (like:hover).Close to 8000 visits and yet only 6 comments, and two are mine… lame…
just kidding man, that’s awesome. What’s the next blog gonna be about?
Arjan, as I mentioned in the comments in this posting, when using -9999px for image replacement, the outline extends to the left to contain the entire element, however instead of doing outline:none you can do overflow:hidden and have the outline not extend all the way to the left. Also with a clear a:focus and a:active defined you can use outline:none and not have any accessibility issues. It is up to the developer to utilize all techniques together to create a well designed and easily accessible website.
Sure you can disable the outline by using
:active. But I meant applying a whole new style for the active state. You can, for example, use an background image with a kind of glow to highlight the usage of a tab. Of course there are way more creative solutions.What I forgot in my previous comment, is mentioning that using
text-indentitself can be harmful. If the visitor has turned images off, there will be nothing to display. (Of course I know that not many people have CSS turned on, but images off… I just mention it.)Ahhh thanks, that’s a great help, cheers
From userstyles.org/forum/comments.php?DiscussionID=371:
*|*:-moz-any-link:focus {
outline-width: 0 !important;
}
Great tip, thanks
Wow, this is great! I didn’t even realize that was possible. I just assumed it was a firefox feature or something. I’m going to take advantage of this one!
Thanks.
Urm…am I the only one this doesn’t work for?
I haven’t got dashed borders happening to my links in firefox but instead Ive got single blue outlines appearing around my links and I applied the first technique shown and its still stayed the same.
Any ideas?
Hey no worries, I found it somewhere else, just add into your html bit
coolio hoolio
didnt come out but…. border=”0″ after your image src bit of html
Hello there.
Just found your site. Great job!
I like it much.
look here http://live.com
this post rules! I was about to just give up. Thanks!
works perfectly, thanks for the big help
I’m still laughing about whoever said, “people who go to links on pages using the tab key, ”
I mean – WHO browses a page like that?
Use a mouse.
People with disabilites such as low mobility. Thanks for dropping by.
STUMBLED!
Excellent tip, will definitely use this.
if you lost all hope try this in your linked css file:
a{
outline: none;
border: none;
}
a:link img{
outline: none;
border: none;
}
a:visited img{
outline: none;
border: none;
}
a:hover img{
outline: none;
border: none;
}
a:active img{
outline: none;
border: none;
}
a:focus img{
outline: none;
border: none;
}
Thanks a lot! I’ve been looking for this everywhere
Thanks man! Looking all over the web. Great solution, really simple!
thanks so much, this is great!
that code posted by olek did just the trick for me, so many thanks!!! I’ll go back through the other sites ive made and put those changes to them too. I just hated giving them to clients and hoping that they would view their site in IE…
Excellent tip there, used it on my blog so you get a stumble thumb up.
[...] Get rid of dotted border from links [...]
I already knew how to do this, but I just had to comment on how beautiful your site is. Amazing choice of colors.
Sorry to go off topic for a moment.
Very useful, thank you! I was already wondering how o get rid of those ugly outlines…
Thanks for posting this. I found it quite useful. I read alot about Accessibility in the comments. Are there any decent 508 compliance validators that actually work?
Thx for the info,
however , new to the CSS style.. no idea where and how to place this code…I have so far jsut created a simple website in photoshop/ dreamweaverCS3 and am looking at a way to remove the annoying border.
Thank you.
I was trying to find out the answer to this by trial and error in my css.
I then did my first search on google for this problem.
This was my search: ‘get rid of dotted border on active link’
Your blog site here is ace
CommentsThis is awesome, Deb! ,
Thanks you saved the day! Thumbs up! On stumbleupon and the real world!
Wow this fixed the issue regarding the display of those pesky borders. Now my question is how do I make the space between the 2 link images smaller or lessen it. I cant figure out a way to make the images get closer. They still have a spacing between them as if the dotted border were still active.
I know this topic is a bit old but really helpful and I appreciate any help u can provide.
[...] If you need visually selected focused elements, do not rely on browsers’ implementation. Just get rid of the active border and use your own highlighting [...]
rock on.
tooo easy to think it out myself
Yes sir. ty very much, Haaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa… …aaalrighty then!