Jump to content

Remove dotted border after click


Archdeacon
 Share

Recommended Posts

After I click an Href to a new image the dotted border still remains. I have tried 'a {outline:none}' but does not seem to work.I am just a beginner at CSS so please forgive my ignorance (Javascript is no problem). The page has 2 '<a HREF>' elements.

Link to comment
Share on other sites

a {outline:none;} should work in all cases whether a:hover, a:visited or a:active etc, only if you change the outline within one of these states will it revert to the styling assigned to this specific state.make sure the style tag and type are correct, clear browser history/Private Data and refresh page<style type="text/css">a {outline:none;}</style>

Link to comment
Share on other sites

If you've been testing in IE6 (and 7, maybe) the outline thing won't work, as those versions of IE don't understand the outline property.

Link to comment
Share on other sites

It is a focus issue. If you have a javascript function called by your href, then in that JavaScript change focus to a nutral place on you page. I tried the blur method, but that did not work. Refocus to another area. That worked for me accross the browsers.

Link to comment
Share on other sites

Basically:

window.onload = function() { // bind a function to the window load event	anchors = document.getElementsByTagName("a"); // get all anchors	for (x in anchors) { // loop through them		if (anchors[x].getElementsByTagName("img").length) { // if there is an image			anchors[x].onfocus = function() { // bind a function to the focus event...				this.blur(); // blurring it again			}		}	}}

Note that this is bad for accessibility, though, as users will not be able to select the anchor using devices other than the mouse, e.g., keyboards.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...