When I click on a link, most browsers draw a dotted box around it. It's easiest to see if the link is opened in a new window, since the original page sticks around.
Can this be stopped?
HTML5 is now compatible with all popular browsers (Chrome, Firefox, Safari, IE9, and Opera) and with the introduction of DOCTYPE, it is even possible to have a few HTML features in older versions of Internet Explorer too.
It look different because each browser has his own CSS style defined. This styles apply to the HTML markup when no other CSS is defined inline or comes from an external CSS file.
Put this in your CSS
-moz-outline: none;
outline: none;
Here's a more detailed breakdown and a related question
http://css-tricks.com/removing-the-dotted-outline/
better use:
a:active {
outline: none;
}
or
a {
outline: none;
}
it's more specific. otherwise you might suppress too many things at once. and if you care for accessibility make sure to give the users who can't use a mouse some other way of knowing which link is active or focused.
One option is to use the javascript blur
function on the link after it's been clicked. The blur
function removes focus off the link so it won't be drawn with that dotted box around it.
If you're using jQuery, then you could implement such a solution like this:
$(function() {
$('a').click(function() {
$(this).blur();
});
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With