Jump to content

Remove dotted border after click


Archdeacon

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

Not working I am afraid. Still it persists with all these attempts!
ok so post the codeif it is lengthy, just post the HTML around the image and related styles
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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...